From: Chun-wei Fan Date: Mon, 8 May 2023 02:59:51 +0000 (+0800) Subject: gdkglcontext-win32-wgl.c: Fix WGL context realization on 32-bit X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~1^2~293^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d02ae09124aa2bfbc71ed4404ebe6accef861bec;p=gtk4.git gdkglcontext-win32-wgl.c: Fix WGL context realization on 32-bit We are currently using g_clear_pointer() on the intermediate WGL contexts (HGLRC)'s that we need to create in the way, which means that we need to ensure that the correct calling convention for wglDeleteContext() is being applied. To be absolutely safe about it, use the gdk_win32_private_wglDeleteContext() calls, which will in turn call wglDeleteContext() directly from opengl32.dll (using the OpenGL headers from the Windows SDK) instead of going via libepoxy, which will assure us that the correct calling convention is applied. Fixes issue #5808. --- diff --git a/gdk/win32/gdkglcontext-win32-wgl.c b/gdk/win32/gdkglcontext-win32-wgl.c index f1efe9124e..9a7e5f3b52 100644 --- a/gdk/win32/gdkglcontext-win32-wgl.c +++ b/gdk/win32/gdkglcontext-win32-wgl.c @@ -456,7 +456,7 @@ create_wgl_context (GdkGLContext *context, if (hglrc_base == NULL || !wglMakeCurrent (hdc, hglrc_base)) { - g_clear_pointer (&hglrc_base, wglDeleteContext); + g_clear_pointer (&hglrc_base, gdk_win32_private_wglDeleteContext); g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE, _("Unable to create a GL context")); @@ -513,7 +513,7 @@ create_wgl_context (GdkGLContext *context, gdk_gl_context_set_is_legacy (context, legacy); } - g_clear_pointer (&hglrc_base, wglDeleteContext); + g_clear_pointer (&hglrc_base, gdk_win32_private_wglDeleteContext); wglMakeCurrent (hdc_current, hglrc_current);