diff options
author | Willem Jan Palenstijn | 2010-04-28 21:50:54 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2010-04-28 21:50:54 +0000 |
commit | ee63bf51bd4c2e4a56fefff721e6298bd7f03378 (patch) | |
tree | b5140fa63a51f2821ee964608c703389e077766a | |
parent | e432c6d21ada0a63d07df4b1d8b44ea293917ac3 (diff) | |
download | scummvm-rg350-ee63bf51bd4c2e4a56fefff721e6298bd7f03378.tar.gz scummvm-rg350-ee63bf51bd4c2e4a56fefff721e6298bd7f03378.tar.bz2 scummvm-rg350-ee63bf51bd4c2e4a56fefff721e6298bd7f03378.zip |
Fix Nippon Safes test result label memory leak
svn-id: r48837
-rw-r--r-- | engines/parallaction/callables_ns.cpp | 12 | ||||
-rw-r--r-- | engines/parallaction/parallaction.h | 3 | ||||
-rw-r--r-- | engines/parallaction/parallaction_ns.cpp | 9 |
3 files changed, 18 insertions, 6 deletions
diff --git a/engines/parallaction/callables_ns.cpp b/engines/parallaction/callables_ns.cpp index f23b78883a..a493523301 100644 --- a/engines/parallaction/callables_ns.cpp +++ b/engines/parallaction/callables_ns.cpp @@ -409,14 +409,14 @@ void Parallaction_ns::_c_testResult(void *parm) { parseLocation("common"); - GfxObj *labels[2]; - labels[0] = _gfx->createLabel(_menuFont, _location._slideText[0].c_str(), 1); - labels[1] = _gfx->createLabel(_menuFont, _location._slideText[1].c_str(), 1); + destroyTestResultLabels(); - _gfx->showLabel(labels[0], CENTER_LABEL_HORIZONTAL, 38); - _gfx->showLabel(labels[1], CENTER_LABEL_HORIZONTAL, 58); + _testResultLabels[0] = _gfx->createLabel(_menuFont, _location._slideText[0].c_str(), 1); + _testResultLabels[1] = _gfx->createLabel(_menuFont, _location._slideText[1].c_str(), 1); + + _gfx->showLabel(_testResultLabels[0], CENTER_LABEL_HORIZONTAL, 38); + _gfx->showLabel(_testResultLabels[1], CENTER_LABEL_HORIZONTAL, 58); - // FIXME: this leaks two labels return; } diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index bc2ab77eba..52ea0c62ec 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -439,6 +439,7 @@ private: void loadProgram(AnimationPtr a, const char *filename); void freeLocation(bool removeAll); void freeCharacter(); + void destroyTestResultLabels(); void startMovingSarcophagus(ZonePtr sarc); void stopMovingSarcophagus(); @@ -460,6 +461,8 @@ private: static const Callable _dosCallables[25]; static const Callable _amigaCallables[25]; + GfxObj *_testResultLabels[2]; + PathWalker_NS *_walker; // common callables diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp index 5a97e80208..ad9ec96ad5 100644 --- a/engines/parallaction/parallaction_ns.cpp +++ b/engines/parallaction/parallaction_ns.cpp @@ -228,8 +228,17 @@ Parallaction_ns::~Parallaction_ns() { _location._animations.remove(_char._ani); delete _walker; + + destroyTestResultLabels(); } +void Parallaction_ns::destroyTestResultLabels() { + for (int i = 0; i < 2; ++i) { + _gfx->unregisterLabel(_testResultLabels[i]); + delete _testResultLabels[i]; + _testResultLabels[i] = 0; + } +} void Parallaction_ns::freeFonts() { |