diff options
author | uruk | 2014-07-03 00:39:23 +0200 |
---|---|---|
committer | uruk | 2014-07-04 12:58:46 +0200 |
commit | b9dc93c451d891704d828e3c384aae015a63ff40 (patch) | |
tree | c3acbd4063db352acd98a37ee9988261a4cc8094 /engines/cge2/snail.cpp | |
parent | 1305bc8aa8b46459dfea08ad52309a57dbda64d8 (diff) | |
download | scummvm-rg350-b9dc93c451d891704d828e3c384aae015a63ff40.tar.gz scummvm-rg350-b9dc93c451d891704d828e3c384aae015a63ff40.tar.bz2 scummvm-rg350-b9dc93c451d891704d828e3c384aae015a63ff40.zip |
CGE2: Heavily rework memory management of Sprites.
Hopefully it will solve a bunch of memory leak problems.
Now Spare is a central container, which stores pointers to every Sprite currently used by the engine.
Because of that, there's no more need for Queue's clear().
In case of snKill(), it's just a safeguard, since it's only used by the engine to "kill" the speech bubbles, but we will check Spare anyway, so it's the safest this way.
Diffstat (limited to 'engines/cge2/snail.cpp')
-rw-r--r-- | engines/cge2/snail.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/engines/cge2/snail.cpp b/engines/cge2/snail.cpp index 9b77fe359e..609196cc26 100644 --- a/engines/cge2/snail.cpp +++ b/engines/cge2/snail.cpp @@ -344,9 +344,10 @@ void CGE2Engine::snKill(Sprite *spr) { hide1(spr); _vga->_showQ->remove(spr); _eventManager->clearEvent(spr); - if (spr->_flags._kill) + if (spr->_flags._kill) { + _spare->take(spr->_ref); delete spr; - else { + } else { spr->setScene(-1); _spare->dispose(spr); } |