From 078d9b4a57056f80056cd25522ee3143b2f4cc77 Mon Sep 17 00:00:00 2001 From: Miguel Pozo Date: Tue, 25 Mar 2025 15:41:30 +0100 Subject: [PATCH] Fix #136345: Win32 Error# (6): The handle is invalid Calling wglMakeCurrent(nullptr, nullptr) without an active context returns an error, so we always pass the device context handle. Pull Request: https://projects.blender.org/blender/blender/pulls/136462 --- intern/ghost/intern/GHOST_ContextWGL.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/intern/ghost/intern/GHOST_ContextWGL.cc b/intern/ghost/intern/GHOST_ContextWGL.cc index 4e05f134faf..54ff1b80d5a 100644 --- a/intern/ghost/intern/GHOST_ContextWGL.cc +++ b/intern/ghost/intern/GHOST_ContextWGL.cc @@ -120,7 +120,9 @@ GHOST_TSuccess GHOST_ContextWGL::activateDrawingContext() GHOST_TSuccess GHOST_ContextWGL::releaseDrawingContext() { - if (WIN32_CHK(::wglMakeCurrent(nullptr, nullptr))) { + /* Calling wglMakeCurrent(nullptr, nullptr) without an active context returns an error, + * so we always pass the device context handle. */ + if (WIN32_CHK(::wglMakeCurrent(m_hDC, nullptr))) { return GHOST_kSuccess; } else {