From fa0ea5c41f53119c68748a0e8570ef120b7fa703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 3 Dec 2023 16:06:31 +0100 Subject: [PATCH] Fix potential violation of invariant The shared function for reading back context attributes, _glfwRefreshContextAttribs, did not check whether the newly created context had been successfully made current. This violated the invariant that the context TLS slot always points to a valid window and that its context is current whenever _glfw.platform.getProcAddress is called. Related to #2327 --- src/context.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/context.c b/src/context.c index 33b399c9..f8610e1e 100644 --- a/src/context.c +++ b/src/context.c @@ -363,6 +363,8 @@ GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window, previous = _glfwPlatformGetTls(&_glfw.contextSlot); glfwMakeContextCurrent((GLFWwindow*) window); + if (_glfwPlatformGetTls(&_glfw.contextSlot) != window) + return GLFW_FALSE; window->context.GetIntegerv = (PFNGLGETINTEGERVPROC) window->context.getProcAddress("glGetIntegerv");