diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-02-16 01:25:53 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-02-16 01:25:53 +0300 |
commit | a674fef72eb6f8bc1ba25ef6c7aef0193a0e59dc (patch) | |
tree | 7ef98150a2e2a36a5c667531b2f613457d6c7d8d /src | |
parent | 59321c4bac45456a141639ea371238823bd9f708 (diff) | |
download | plus-a674fef72eb6f8bc1ba25ef6c7aef0193a0e59dc.tar.gz plus-a674fef72eb6f8bc1ba25ef6c7aef0193a0e59dc.tar.bz2 plus-a674fef72eb6f8bc1ba25ef6c7aef0193a0e59dc.tar.xz plus-a674fef72eb6f8bc1ba25ef6c7aef0193a0e59dc.zip |
Fix crash with particle effects with animation/rotation without emitter.
This bug first was detected in brazilian tmw server.
Diffstat (limited to 'src')
-rw-r--r-- | src/simpleanimation.cpp | 13 | ||||
-rw-r--r-- | src/simpleanimation.h | 3 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp index 3e5b40817..67c697348 100644 --- a/src/simpleanimation.cpp +++ b/src/simpleanimation.cpp @@ -40,7 +40,8 @@ SimpleAnimation::SimpleAnimation(Animation *const animation) : mAnimationTime(0), mAnimationPhase(0), mCurrentFrame(&mAnimation->mFrames[0]), - mInitialized(true) + mInitialized(true), + mImageSet(nullptr) { } @@ -50,7 +51,8 @@ SimpleAnimation::SimpleAnimation(const XmlNodePtr animationNode, mAnimationTime(0), mAnimationPhase(0), mCurrentFrame(nullptr), - mInitialized(false) + mInitialized(false), + mImageSet(nullptr) { initializeAnimation(animationNode, dyePalettes); if (mAnimation) @@ -63,6 +65,11 @@ SimpleAnimation::~SimpleAnimation() { delete mAnimation; mAnimation = nullptr; + if (mImageSet) + { + mImageSet->decRef(); + mImageSet = nullptr; + } } bool SimpleAnimation::draw(Graphics *const graphics, @@ -231,6 +238,6 @@ void SimpleAnimation::initializeAnimation(const XmlNodePtr animationNode, } } - imageset->decRef(); +// imageset->decRef(); mInitialized = true; } diff --git a/src/simpleanimation.h b/src/simpleanimation.h index 131cd4c07..e30455a04 100644 --- a/src/simpleanimation.h +++ b/src/simpleanimation.h @@ -30,6 +30,7 @@ class Animation; class Graphics; class Image; +class ImageSet; struct Frame; @@ -91,6 +92,8 @@ class SimpleAnimation final /** Tell whether the animation is ready */ bool mInitialized; + + ImageSet *mImageSet; }; #endif |