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
This commit is contained in:
Miguel Pozo
2025-03-25 15:41:30 +01:00
parent 2663c840df
commit 078d9b4a57

View File

@@ -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 {