summaryrefslogtreecommitdiff
path: root/src/particle/particlelist.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-23 02:14:30 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-23 02:14:30 +0300
commit6a65a4cf5b6b10839254c0c5846ec2dbfea882f8 (patch)
treecdf1dcc071ab18575defff569d33f3cbc8be0348 /src/particle/particlelist.cpp
parent1a5f8957c707625efbcf36722b057d5eda5a21bb (diff)
downloadmanaplus-6a65a4cf5b6b10839254c0c5846ec2dbfea882f8.tar.gz
manaplus-6a65a4cf5b6b10839254c0c5846ec2dbfea882f8.tar.bz2
manaplus-6a65a4cf5b6b10839254c0c5846ec2dbfea882f8.tar.xz
manaplus-6a65a4cf5b6b10839254c0c5846ec2dbfea882f8.zip
Allow delete untracker being particle effects.
This fix some possible memory leaks.
Diffstat (limited to 'src/particle/particlelist.cpp')
-rw-r--r--src/particle/particlelist.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/particle/particlelist.cpp b/src/particle/particlelist.cpp
index 0d2a2f195..209ecfd32 100644
--- a/src/particle/particlelist.cpp
+++ b/src/particle/particlelist.cpp
@@ -44,8 +44,6 @@ void ParticleList::addLocally(Particle *const particle)
{
if (particle)
{
- // The effect may not die without the beings permission or we segfault
- particle->disableAutoDelete();
mElements.push_back(particle);
mSize ++;
}
@@ -74,7 +72,10 @@ void ParticleList::removeLocally(const Particle *const particle)
void ParticleList::clearLocally()
{
FOR_EACH (ParticleListCIter, it, mElements)
+ {
(*it)->kill();
+ (*it)->prepareToDie();
+ }
mElements.clear();
mSize = 0U;