diff options
Diffstat (limited to 'src/particle/particle.cpp')
-rw-r--r-- | src/particle/particle.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp index 22e350123..1df42724b 100644 --- a/src/particle/particle.cpp +++ b/src/particle/particle.cpp @@ -89,17 +89,19 @@ Particle::~Particle() delete2(mAnimation); if (mImage) { - const std::string &restrict name = mImage->getIdPath(); - StringIntMapIter it - = ImageParticle::imageParticleCountByName.find(name); - if (it != ImageParticle::imageParticleCountByName.end()) + if (mType == ParticleType::Image) { - int &cnt = (*it).second; - if (cnt > 0) - cnt --; + const std::string &restrict name = mImage->getIdPath(); + StringIntMapIter it + = ImageParticle::imageParticleCountByName.find(name); + if (it != ImageParticle::imageParticleCountByName.end()) + { + int &cnt = (*it).second; + if (cnt > 0) + cnt --; + } + mImage->decRef(); } - - mImage->decRef(); mImage = nullptr; } |