From 6a65a4cf5b6b10839254c0c5846ec2dbfea882f8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 23 Jul 2016 02:14:30 +0300 Subject: Allow delete untracker being particle effects. This fix some possible memory leaks. --- src/particle/particlelist.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/particle/particlelist.cpp') 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; -- cgit v1.2.3-70-g09d2