LASTEXPRESS: Fix more memory leaks

- Missing deallocation of queued frames in SceneManager
 - Leaking functor on each call to entity setup functions
 - Add SoundEntry destructor & better Entity cleanup

as reported by digitall

svn-id: r54196
This commit is contained in:
Julien Templier 2010-11-11 06:18:23 +00:00
parent da33617061
commit 6711c5a8cf
4 changed files with 13 additions and 2 deletions
engines/lastexpress

View File

@ -150,7 +150,9 @@ Entity::Entity(LastExpressEngine *engine, EntityIndex index) : _engine(engine),
Entity::~Entity() {
for (uint i = 0; i < _callbacks.size(); i++)
delete _callbacks[i];
SAFE_DELETE(_callbacks[i]);
_callbacks.clear();
delete _data;

View File

@ -83,7 +83,7 @@ void class::setup_##name() { \
}
#define BEGIN_SETUP(class, name, index, type) \
_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, new ENTITY_CALLBACK(class, name, this)); \
_engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); \
_data->setCurrentCallback(index); \
_data->resetCurrentParameters<type>();

View File

@ -62,6 +62,10 @@ SceneManager::~SceneManager() {
SAFE_DELETE(_clockHours);
SAFE_DELETE(_clockMinutes);
// Clear frame queue
for (Common::List<SequenceFrame *>::iterator i = _queue.begin(); i != _queue.end(); ++i)
SAFE_DELETE(*i);
// Zero-out passed pointers
_engine = NULL;
}

View File

@ -284,6 +284,11 @@ private:
isStreamed = false;
}
~SoundEntry() {
delete stream;
//delete subtitle;
}
};
// Engine