PINK: fix mem leaks

This commit is contained in:
whiterandrek 2018-06-10 04:21:01 +03:00 committed by Eugene Sandulenko
parent f11d331129
commit 0659ca4846
6 changed files with 14 additions and 1 deletions

View File

@ -36,6 +36,7 @@ GamePage::GamePage()
GamePage::~GamePage() {
clear();
delete _memFile;
}
void GamePage::toConsole() {

View File

@ -40,6 +40,10 @@ Sequencer::~Sequencer() {
for (uint i = 0; i < _sequences.size(); ++i) {
delete _sequences[i];
}
for (uint i = 0; i < _timers.size(); ++i) {
delete _timers[i];
}
removeContext(_context);
}
void Sequencer::deserialize(Archive &archive) {

View File

@ -32,6 +32,12 @@ namespace Pink {
WalkMgr::WalkMgr()
: _isWalking(false), _leadActor(nullptr) {}
WalkMgr::~WalkMgr() {
for (uint i = 0; i < _locations.size(); ++i) {
delete _locations[i];
}
}
void WalkMgr::deserialize(Pink::Archive &archive) {
_leadActor = static_cast<LeadActor *>(archive.readObject());
_locations.deserialize(archive);

View File

@ -42,6 +42,7 @@ struct Coordinates {
class WalkMgr : public Object {
public:
WalkMgr();
~WalkMgr() override;
virtual void deserialize(Archive &archive);
void toConsole() override;

View File

@ -261,6 +261,7 @@ Common::Error PinkEngine::loadGameState(int slot) {
_nextPage = archive.readString();
initModule(archive.readString(), "", &archive);
delete in;
return Common::kNoError;
}

View File

@ -39,7 +39,7 @@ void Sound::play(Common::SafeSeekableSubReadStream *stream, Audio::Mixer::SoundT
mixer->stopHandle(_handle);
Audio::AudioStream *audioStream;
Audio::SeekableAudioStream *wavStream = Audio::makeWAVStream(stream, DisposeAfterUse::NO);
Audio::SeekableAudioStream *wavStream = Audio::makeWAVStream(stream, DisposeAfterUse::YES);
if (isLoop)
audioStream = Audio::makeLoopingAudioStream(wavStream, 0, 0, 0);
else