From 23c708f72a5c49e5f876e8fd80b7e476c450eaeb Mon Sep 17 00:00:00 2001 From: Yves Date: Sat, 9 Aug 2014 20:20:32 +0000 Subject: [PATCH] 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. --- source/scriptinterface/ScriptInterface.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/scriptinterface/ScriptInterface.h b/source/scriptinterface/ScriptInterface.h index 31253bf4ae..530c2451ff 100644 --- a/source/scriptinterface/ScriptInterface.h +++ b/source/scriptinterface/ScriptInterface.h @@ -404,6 +404,9 @@ public: 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 Eval_(const char* code, JS::MutableHandleValue ret); bool Eval_(const wchar_t* code, JS::MutableHandleValue ret);