1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-21 09:39:56 +00:00

FIx static destruction order chaos

This commit is contained in:
AnyOldName3 2024-02-24 00:54:40 +00:00
parent 2bc091fc05
commit dec8d32b3a

View File

@ -13,12 +13,23 @@ namespace SceneUtil
public:
static GLExtensionsObserver sInstance;
~GLExtensionsObserver() override
{
for (auto& ptr : sGLExtensions)
{
osg::ref_ptr<osg::GLExtensions> ref;
if (ptr.lock(ref))
ref->removeObserver(this);
}
}
void objectDeleted(void* referenced) override
{
sGLExtensions.erase(static_cast<osg::GLExtensions*>(referenced));
}
};
// construct after sGLExtensions so this gets destroyed first.
GLExtensionsObserver GLExtensionsObserver::sInstance{};
}