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.
This commit is contained in:
Chun-wei Fan 2023-05-08 10:59:51 +08:00
parent d948ac62e4
commit d02ae09124

View File

@ -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);