Browse Source

Bugfix: Fix crash on shutdown during OpenGL context deletion

BearishSun 8 years ago
parent
commit
917828e246

+ 6 - 0
Source/BansheeGLRenderAPI/BsGLRenderAPI.cpp

@@ -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);
 

+ 1 - 1
Source/BansheeGLRenderAPI/Win32/BsWin32Context.cpp

@@ -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());
 	}