summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2023-04-27 01:27:50 +0200
committerChun-wei Fan <fanchunwei@src.gnome.org>2023-05-09 18:15:23 +0800
commitc37786af360ac1e2b205bff6d84bf47a64253d54 (patch)
treefdca0125cddbe62d29ff8dcb3f46b160d68142cd /gdk
parenta7b09e19f1eea891b60864b79ab14be837606130 (diff)
downloadgtk+-c37786af360ac1e2b205bff6d84bf47a64253d54.tar.gz
win32: Actually increase the counter
We were sending random junk to ChoosePixelFormat(). Also assert that we don't overflow the array. That might be usefu to know if we carelessly add attributes later.
Diffstat (limited to 'gdk')
-rw-r--r--gdk/win32/gdkglcontext-win32-wgl.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gdk/win32/gdkglcontext-win32-wgl.c b/gdk/win32/gdkglcontext-win32-wgl.c
index cc3c3097a9..c6cdbfb533 100644
--- a/gdk/win32/gdkglcontext-win32-wgl.c
+++ b/gdk/win32/gdkglcontext-win32-wgl.c
@@ -153,7 +153,7 @@ get_wgl_pfd (HDC hdc,
HGLRC hglrc_current = wglGetCurrentContext ();
/* Update PIXEL_ATTRIBUTES above if any groups are added here! */
- pixelAttribs[i] = WGL_DRAW_TO_WINDOW_ARB;
+ pixelAttribs[i++] = WGL_DRAW_TO_WINDOW_ARB;
pixelAttribs[i++] = GL_TRUE;
pixelAttribs[i++] = WGL_SUPPORT_OPENGL_ARB;
@@ -183,6 +183,7 @@ get_wgl_pfd (HDC hdc,
}
pixelAttribs[i++] = 0; /* end of pixelAttribs */
+ g_assert (i <= PIXEL_ATTRIBUTES);
best_pf = gdk_init_dummy_wgl_context (display_win32);
if (!wglMakeCurrent (display_win32->dummy_context_wgl.hdc,
@@ -196,8 +197,8 @@ get_wgl_pfd (HDC hdc,
pixelAttribs,
NULL,
1,
- &best_pf,
- &num_formats);
+ &best_pf,
+ &num_formats);
/* Go back to the HDC that we were using, since we are done with the dummy HDC and GL Context */
wglMakeCurrent (hdc_current, hglrc_current);