diff options
author | Andrei Prykhodko | 2018-06-29 17:45:40 +0300 |
---|---|---|
committer | Andrei Prykhodko | 2018-06-29 17:46:55 +0300 |
commit | 247ba1f587929da7040e4d278d51c31a3a4d18ba (patch) | |
tree | f60b584aea6eef28516472b8b3174819defdee8d /engines/pink | |
parent | 8af0e2c7cc15c23269c73902c88343b0b49ce512 (diff) | |
download | scummvm-rg350-247ba1f587929da7040e4d278d51c31a3a4d18ba.tar.gz scummvm-rg350-247ba1f587929da7040e4d278d51c31a3a4d18ba.tar.bz2 scummvm-rg350-247ba1f587929da7040e4d278d51c31a3a4d18ba.zip |
PINK: fixed mem leak
Diffstat (limited to 'engines/pink')
-rw-r--r-- | engines/pink/pda_mgr.cpp | 10 | ||||
-rw-r--r-- | engines/pink/pda_mgr.h | 3 |
2 files changed, 12 insertions, 1 deletions
diff --git a/engines/pink/pda_mgr.cpp b/engines/pink/pda_mgr.cpp index 01ca5a2091..8e8b6eca8b 100644 --- a/engines/pink/pda_mgr.cpp +++ b/engines/pink/pda_mgr.cpp @@ -31,6 +31,13 @@ namespace Pink { PDAMgr::PDAMgr(Pink::PinkEngine *game) : _game(game), _page(nullptr), _cursorMgr(game, nullptr) {} +PDAMgr::~PDAMgr() { + for (uint i = 0; i < _globalActors.size(); ++i) { + delete _globalActors[i]; + } + delete _page; +} + void PDAMgr::saveState(Archive &archive) { if (_page) archive.writeString(_page->getName()); @@ -57,8 +64,9 @@ void PDAMgr::goToPage(const Common::String &pageName) { loadGlobal(); + PDAPage *newPage = new PDAPage(PDAPage::create(pageName, *this)); delete _page; - _page = new PDAPage(PDAPage::create(pageName, *this)); + _page = newPage; _page->init(); diff --git a/engines/pink/pda_mgr.h b/engines/pink/pda_mgr.h index 6521539c51..08c3d96b62 100644 --- a/engines/pink/pda_mgr.h +++ b/engines/pink/pda_mgr.h @@ -23,6 +23,8 @@ #ifndef PINK_PDA_MGR_H #define PINK_PDA_MGR_H +#include "common/stack.h" + #include "pink/cursor_mgr.h" #include "pink/utils.h" @@ -38,6 +40,7 @@ struct Command; class PDAMgr { public: PDAMgr(PinkEngine *game); + ~PDAMgr(); void loadState(Archive &archive) { _savedPage = archive.readString(); } void saveState(Archive &archive); |