From 1cb8ab8dc6ec0eda054a0bb18fdbe9626784dc0f Mon Sep 17 00:00:00 2001 From: Doug Binks Date: Thu, 16 Jul 2020 11:59:11 +0100 Subject: [PATCH] Make user context non current when destroyed --- src/context.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/context.c b/src/context.c index 8db76c84..d12ba991 100644 --- a/src/context.c +++ b/src/context.c @@ -775,14 +775,14 @@ GLFWAPI GLFWusercontext* glfwCreateUserContext(GLFWwindow* handle) GLFWAPI void glfwDestroyUserContext(GLFWusercontext* handle) { _GLFWusercontext* context = (_GLFWusercontext*)handle; - _GLFWusercontext* prev = _glfwPlatformGetTls(&_glfw.usercontextSlot); + _GLFWusercontext* current = _glfwPlatformGetTls(&_glfw.usercontextSlot); _GLFW_REQUIRE_INIT(); if (context) { - if(prev==context) - _glfwPlatformSetTls(&_glfw.usercontextSlot,NULL); + if(current==context) + glfwMakeContextCurrent(NULL); context->destroy(context); }