diff options
-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); |