Fix a ref-count loop in Paticles manager

This commit is contained in:
James Turner 2021-07-29 15:21:39 +01:00
parent 67bb39083c
commit d6e452ea08
2 changed files with 9 additions and 1 deletions

View File

@ -516,6 +516,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<std::mutex> g(d->_lock);

View File

@ -150,7 +150,7 @@ protected:
class ParticlesGlobalManager
{
public:
~ParticlesGlobalManager() = default;
~ParticlesGlobalManager();
static ParticlesGlobalManager* instance();
static void clear();