diff --git a/simgear/scene/model/particles.cxx b/simgear/scene/model/particles.cxx index 5a817d0e..3c43bf56 100644 --- a/simgear/scene/model/particles.cxx +++ b/simgear/scene/model/particles.cxx @@ -512,6 +512,14 @@ void Particles::setupStaticColorComponent(float r1, float g1, float b1, float a1 staticColorComponents[7] = a2; } +ParticlesGlobalManager::~ParticlesGlobalManager() +{ + // break a ref-counting cycle + if (d->_commonRoot) { + d->_commonRoot->removeUpdateCallback(d.get()); + } +} + void ParticlesGlobalManager::setWindVector(const osg::Vec3& wind) { std::lock_guard g(d->_lock); diff --git a/simgear/scene/model/particles.hxx b/simgear/scene/model/particles.hxx index b5af333f..f99ba832 100644 --- a/simgear/scene/model/particles.hxx +++ b/simgear/scene/model/particles.hxx @@ -150,7 +150,7 @@ protected: class ParticlesGlobalManager { public: - ~ParticlesGlobalManager() = default; + ~ParticlesGlobalManager(); static ParticlesGlobalManager* instance(); static void clear();