From 7d1d6f4c001a80c05fd4f792cb6356ee546367ea Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 8 Jun 2011 22:44:47 +0300 Subject: Possible final fix with imageset memory leaks and crashes. --- src/particleemitter.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp index 592d9b078..844da5dad 100644 --- a/src/particleemitter.cpp +++ b/src/particleemitter.cpp @@ -210,7 +210,7 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, logger->log1("Error: no valid imageset"); continue; } -// mTempSets.push_back(imageset); + mTempSets.push_back(imageset); // Get animation frames for_each_xml_child_node(frameNode, propertyNode) @@ -294,7 +294,7 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, logger->log1("Error: no valid imageset"); continue; } -// mTempSets.push_back(imageset); + mTempSets.push_back(imageset); // Get animation frames for_each_xml_child_node(frameNode, propertyNode) @@ -427,6 +427,15 @@ ParticleEmitter & ParticleEmitter::operator=(const ParticleEmitter &o) mParticleChildEmitters = o.mParticleChildEmitters; mDeathEffectConditions = o.mDeathEffectConditions; mDeathEffect = o.mDeathEffect; + mTempSets = o.mTempSets; + + for (std::list::iterator + i = mTempSets.begin(); + i != mTempSets.end(); ++i) + { + if (*i) + (*i)->incRef(); + } mOutputPauseLeft = 0; @@ -436,10 +445,8 @@ ParticleEmitter & ParticleEmitter::operator=(const ParticleEmitter &o) return *this; } - ParticleEmitter::~ParticleEmitter() { -/* for (std::list::iterator i = mTempSets.begin(); i != mTempSets.end(); ++i) @@ -448,7 +455,6 @@ ParticleEmitter::~ParticleEmitter() (*i)->decRef(); } mTempSets.clear(); -*/ if (mParticleImage) { -- cgit v1.2.3-70-g09d2