diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 5a1b1dcb..36a040e2 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -43,6 +43,7 @@ video tutorials. - Noel Cower - CuriouserThing - Jason Daly + - danhambleton - Jarrod Davis - Olivier Delannoy - Paul R. Deppe diff --git a/README.md b/README.md index 8fea84b8..1d16c6a4 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,7 @@ information on what to include when reporting a bug. ## Changelog + - Bugfix: `glfwMakeContextCurrent` would access TLS slot before initialization - [Win32] Bugfix: `Alt+PrtSc` would emit `GLFW_KEY_UNKNOWN` and a different scancode than `PrtSc` (#1993) - [Win32] Bugfix: `GLFW_KEY_PAUSE` scancode from `glfwGetKeyScancode` did not diff --git a/src/context.c b/src/context.c index b3c78e80..d86e0fae 100644 --- a/src/context.c +++ b/src/context.c @@ -609,10 +609,12 @@ GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; - _GLFWwindow* previous = _glfwPlatformGetTls(&_glfw.contextSlot); + _GLFWwindow* previous; _GLFW_REQUIRE_INIT(); + previous = _glfwPlatformGetTls(&_glfw.contextSlot); + if (window && window->context.client == GLFW_NO_API) { _glfwInputError(GLFW_NO_WINDOW_CONTEXT,