Make user context non current when destroyed

This commit is contained in:
Doug Binks 2020-07-16 11:59:11 +01:00
parent 87ddca831a
commit 1cb8ab8dc6

View File

@ -775,14 +775,14 @@ GLFWAPI GLFWusercontext* glfwCreateUserContext(GLFWwindow* handle)
GLFWAPI void glfwDestroyUserContext(GLFWusercontext* handle) GLFWAPI void glfwDestroyUserContext(GLFWusercontext* handle)
{ {
_GLFWusercontext* context = (_GLFWusercontext*)handle; _GLFWusercontext* context = (_GLFWusercontext*)handle;
_GLFWusercontext* prev = _glfwPlatformGetTls(&_glfw.usercontextSlot); _GLFWusercontext* current = _glfwPlatformGetTls(&_glfw.usercontextSlot);
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
if (context) if (context)
{ {
if(prev==context) if(current==context)
_glfwPlatformSetTls(&_glfw.usercontextSlot,NULL); glfwMakeContextCurrent(NULL);
context->destroy(context); context->destroy(context);
} }