1
0
forked from 0ad/0ad

Prevent copying of ScriptInterface objects.

Copying a ScriptInterface is not allowed. The destructor destroys the
JSContext and if there's a copy around that still uses it, that causes
crashes which can be quite hard to debug. This change prevents copying
by of ScriptInterface objects by making the copy constructor private,
which will reveal such errors at compile time.

This was SVN commit r15625.
This commit is contained in:
Yves 2014-08-09 20:20:32 +00:00
parent 83aa817f71
commit 23c708f72a

View File

@ -404,6 +404,9 @@ public:
private: private:
// Prevent copying of ScriptInterface objects.
ScriptInterface(const ScriptInterface&) {};
bool CallFunction_(JS::HandleValue val, const char* name, uint argc, jsval* argv, JS::MutableHandleValue ret); bool CallFunction_(JS::HandleValue val, const char* name, uint argc, jsval* argv, JS::MutableHandleValue ret);
bool Eval_(const char* code, JS::MutableHandleValue ret); bool Eval_(const char* code, JS::MutableHandleValue ret);
bool Eval_(const wchar_t* code, JS::MutableHandleValue ret); bool Eval_(const wchar_t* code, JS::MutableHandleValue ret);