diff options
author | Max Horn | 2010-10-23 15:44:04 +0000 |
---|---|---|
committer | Max Horn | 2010-10-23 15:44:04 +0000 |
commit | c483a22f2a8c02c2b1ecaf5f9626999fd3ed3c7e (patch) | |
tree | 157405c31e1e03dd43def80ec8445d6fb0f4a7e5 /engines/sword25/gfx | |
parent | 3e657c1bf961390bf645a27c6616b527e457d372 (diff) | |
download | scummvm-rg350-c483a22f2a8c02c2b1ecaf5f9626999fd3ed3c7e.tar.gz scummvm-rg350-c483a22f2a8c02c2b1ecaf5f9626999fd3ed3c7e.tar.bz2 scummvm-rg350-c483a22f2a8c02c2b1ecaf5f9626999fd3ed3c7e.zip |
SWORD25: Get rid of global SharedPtr instances
svn-id: r53734
Diffstat (limited to 'engines/sword25/gfx')
-rw-r--r-- | engines/sword25/gfx/graphicengine.cpp | 1 | ||||
-rw-r--r-- | engines/sword25/gfx/graphicengine.h | 1 | ||||
-rw-r--r-- | engines/sword25/gfx/graphicengine_script.cpp | 19 |
3 files changed, 17 insertions, 4 deletions
diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index 37499cc14d..54aa243cd8 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -85,6 +85,7 @@ GraphicEngine::GraphicEngine(Kernel *pKernel) : } GraphicEngine::~GraphicEngine() { + unregisterScriptBindings(); _backSurface.free(); _frameBuffer.free(); delete _thumbnail; diff --git a/engines/sword25/gfx/graphicengine.h b/engines/sword25/gfx/graphicengine.h index 5820a8d420..26eeaa2e22 100644 --- a/engines/sword25/gfx/graphicengine.h +++ b/engines/sword25/gfx/graphicengine.h @@ -363,6 +363,7 @@ protected: private: bool registerScriptBindings(); + void unregisterScriptBindings(); // LastFrameDuration Variables // --------------------------- diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp index 956c0352f0..fa97b80c82 100644 --- a/engines/sword25/gfx/graphicengine_script.cpp +++ b/engines/sword25/gfx/graphicengine_script.cpp @@ -71,8 +71,8 @@ protected: } }; -Common::ScopedPtr<LuaCallback> loopPointCallbackPtr; -Common::ScopedPtr<ActionCallback> actionCallbackPtr; +static LuaCallback *loopPointCallbackPtr = 0; // FIXME: should be turned into GraphicEngine member var +static ActionCallback *actionCallbackPtr = 0; // FIXME: should be turned into GraphicEngine member var struct CallbackfunctionRegisterer { CallbackfunctionRegisterer() { @@ -1289,10 +1289,21 @@ bool GraphicEngine::registerScriptBindings() { if (!LuaBindhelper::addFunctionsToLib(L, GFX_LIBRARY_NAME, GFX_FUNCTIONS)) return false; - loopPointCallbackPtr.reset(new LuaCallback(L)); - actionCallbackPtr.reset(new ActionCallback(L)); + assert(loopPointCallbackPtr == 0); + loopPointCallbackPtr = new LuaCallback(L); + + assert(actionCallbackPtr == 0); + actionCallbackPtr = new ActionCallback(L); return true; } +void GraphicEngine::unregisterScriptBindings() { + delete loopPointCallbackPtr; + loopPointCallbackPtr = 0; + + delete actionCallbackPtr; + actionCallbackPtr = 0; +} + } // End of namespace Sword25 |