diff options
author | uruk | 2013-09-05 13:29:16 +0200 |
---|---|---|
committer | uruk | 2013-09-05 13:29:16 +0200 |
commit | 3de1b45b62168b39824a6311344ded0edcf04cf3 (patch) | |
tree | 7800ce54d728edd5b5e4d9c1754dc8127b48c164 | |
parent | 390ecc6a6b1eb65a3c0e1ba68d907afaeb9778b7 (diff) | |
download | scummvm-rg350-3de1b45b62168b39824a6311344ded0edcf04cf3.tar.gz scummvm-rg350-3de1b45b62168b39824a6311344ded0edcf04cf3.tar.bz2 scummvm-rg350-3de1b45b62168b39824a6311344ded0edcf04cf3.zip |
AVALANCHE: Repair memory leaks in Dropdown.
-rw-r--r-- | engines/avalanche/dropdown2.cpp | 6 | ||||
-rw-r--r-- | engines/avalanche/lucerna2.cpp | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 53357691b9..793fc91114 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -762,6 +762,7 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... if (_activeMenuItem._activeNow) { _activeMenuItem.wipe(); _vm->_lucerna->holdLeftMouse = false; + backup.free(); return; } // No "else"- clicking on menu has no effect (only releasing). } @@ -775,6 +776,7 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... if (((_activeMenuItem._left * 8) <= cursorPos.x) && (cursorPos.x <= (_activeMenuItem._left * 8 + 80))) { // 80: the width of one menu item on the bar in pixels. // If we clicked on the same menu item (the one that is already active) on the bar... _vm->_lucerna->holdLeftMouse = false; + backup.free(); return; } else { _vm->_lucerna->holdLeftMouse = true; @@ -800,8 +802,10 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it... uint16 which = (cursorPos.y - 26) / 20; _activeMenuItem.select(which); - if (_activeMenuItem._options[which]._valid) // If the menu item wasn't active, we do nothing. + if (_activeMenuItem._options[which]._valid) { // If the menu item wasn't active, we do nothing. + backup.free(); return; + } } } diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 4673a5f195..4c9997e091 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -58,8 +58,8 @@ Lucerna::Lucerna(AvalancheEngine *vm) : fxhidden(false) { } Lucerna::~Lucerna() { - for (byte i = 0; i < 31; i++) - for (byte j = 0; j < 2; j++) + for (int i = 0; i < 31; i++) + for (int j = 0; j < 2; j++) delete _vm->_gyro->also[i][j]; } |