aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/callables_ns.cpp12
-rw-r--r--engines/parallaction/parallaction.h3
-rw-r--r--engines/parallaction/parallaction_ns.cpp9
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() {