@@ -244,6 +244,12 @@ namespace bs { namespace ct
if(mProgramPipelineManager != nullptr)
bs_delete(mProgramPipelineManager);
+ if(mCurrentContext)
+ mCurrentContext->endCurrent();
+
+ mCurrentContext = nullptr;
+ mMainContext = nullptr;
if(mGLSupport)
bs_delete(mGLSupport);
@@ -28,7 +28,7 @@ namespace bs { namespace ct
void Win32Context::endCurrent()
{
- if(wglMakeCurrent(0, 0) != TRUE)
+ if(wglMakeCurrent(mHDC, 0) != TRUE)
BS_EXCEPT(RenderingAPIException, "wglMakeCurrent failed: " + translateWGLError());
}