Commit 331837d7 authored by Jan Lepper's avatar Jan Lepper

fix crash when calling gl::Disable whith no current context (may happen on shutdown)

parent f4060b5b
......@@ -1197,10 +1197,13 @@ void GLAPIENTRY wrap_Disable(GLenum cap)
{
assert(wgl_wrapper::isMainThread());
gl::Disable(cap);
if (!wgl_wrapper::isShuttingDown())
{
gl::Disable(cap);
if (wgl_wrapper::isMainContextCurrent())
setEnabled(cap, false);
if (wgl_wrapper::isMainContextCurrent())
setEnabled(cap, false);
}
}
......
......@@ -57,6 +57,7 @@ namespace wgl_wrapper
static constexpr bool isMainThread() { return true; }
bool isMainContextCurrent();
bool isShuttingDown();
void *getProcAddress(HMODULE module, LPCSTR name);
ContextData *getContext();
ContextData *getMainContext();
......
......@@ -306,6 +306,12 @@ ContextData *getMainContext()
}
bool isShuttingDown()
{
return g_data.m_in_shutdown;
}
core::Scene *getScene()
{
return getContext()->getScene();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment