summaryrefslogtreecommitdiff
path: root/src/resources/spritedef.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2007-10-23 08:02:22 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2007-10-23 08:02:22 +0000
commit8eda6c18fd391e34f180aaece96140a374f274f9 (patch)
tree9598ebf5280790951b30befe9c84d4bba57198e4 /src/resources/spritedef.cpp
parentc9f618b5c50f759cf172d8e37063ef56e05812cf (diff)
downloadmana-8eda6c18fd391e34f180aaece96140a374f274f9.tar.gz
mana-8eda6c18fd391e34f180aaece96140a374f274f9.tar.bz2
mana-8eda6c18fd391e34f180aaece96140a374f274f9.tar.xz
mana-8eda6c18fd391e34f180aaece96140a374f274f9.zip
Merged changesets 3653, 3655-3657, 3659-3560, 3671-3672 from trunk to
0.0. Mostly memory leak fixes by Guillaume.
Diffstat (limited to 'src/resources/spritedef.cpp')
-rw-r--r--src/resources/spritedef.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index 24156be1..1e7c102d 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -21,6 +21,8 @@
* $Id$
*/
+#include <set>
+
#include "spritedef.h"
#include "../log.h"
@@ -292,6 +294,20 @@ SpriteDef::substituteAction(SpriteAction complete, SpriteAction with)
SpriteDef::~SpriteDef()
{
+ // Actions are shared, so ensure they are deleted only once.
+ std::set< Action * > actions;
+ for (Actions::const_iterator i = mActions.begin(),
+ i_end = mActions.end(); i != i_end; ++i)
+ {
+ actions.insert(i->second);
+ }
+
+ for (std::set< Action * >::const_iterator i = actions.begin(),
+ i_end = actions.end(); i != i_end; ++i)
+ {
+ delete *i;
+ }
+
for (ImageSetIterator i = mImageSets.begin();
i != mImageSets.end(); ++i)
{