diff --git a/simgear/scene/model/particles.cxx b/simgear/scene/model/particles.cxx index 7189e2bf..8dee9e7f 100644 --- a/simgear/scene/model/particles.cxx +++ b/simgear/scene/model/particles.cxx @@ -71,6 +71,7 @@ public: void registerNewWorldParticleSystem(osg::Node* node, ParticleSystemRef ps, osg::Group* frame); std::mutex _lock; + bool _inited = false; bool _frozen = false; double _simulationDt = 0.0; osg::ref_ptr _commonRoot; @@ -184,6 +185,10 @@ void ParticlesGlobalManager::ParticlesGlobalManagerPrivate::registerNewWorldPart void ParticlesGlobalManager::initFromMainThread() { std::lock_guard g(d->_lock); + if (d->_inited) + return; + + d->_inited = true; d->internalGetCommonRoot(); d->_commonRoot->addUpdateCallback(d.get()); d->_commonRoot->setCullingActive(false);