summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-21 15:36:50 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-21 15:36:50 +0000
commiteba00c570137f690ea75b2e05974c241b2f2bdcb (patch)
treeacbff1eaaeec8dae5d449e329ca0d6fea4eaa574 /src/resources
parent40e1b46019afe72bb05614162b3b907db999cc57 (diff)
downloadmana-client-eba00c570137f690ea75b2e05974c241b2f2bdcb.tar.gz
mana-client-eba00c570137f690ea75b2e05974c241b2f2bdcb.tar.bz2
mana-client-eba00c570137f690ea75b2e05974c241b2f2bdcb.tar.xz
mana-client-eba00c570137f690ea75b2e05974c241b2f2bdcb.zip
Plugged memory leak in sprites.
Diffstat (limited to 'src/resources')
-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 0daa0cc0..45a52d2e 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -21,6 +21,8 @@
* $Id$
*/
+#include <set>
+
#include "spritedef.h"
#include "../log.h"
@@ -289,6 +291,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)
{