summaryrefslogtreecommitdiffstats
path: root/src/glx
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2010-05-07 18:38:35 -0400
committerKristian Høgsberg <krh@bitplanet.net>2010-05-07 18:40:54 -0400
commitdb178af09d734f2f973d50de9ff90fe1cbb5e9c9 (patch)
tree3ea7708425f78d026923ec5abf8588226e13cac6 /src/glx
parentf350b106171795fec39ed47ef34a451949c84c33 (diff)
downloadexternal_mesa3d-db178af09d734f2f973d50de9ff90fe1cbb5e9c9.zip
external_mesa3d-db178af09d734f2f973d50de9ff90fe1cbb5e9c9.tar.gz
external_mesa3d-db178af09d734f2f973d50de9ff90fe1cbb5e9c9.tar.bz2
glx: Get GLX_SCREEN first in __glXQueryContextInfo()
And lookup the GLX screen for the context. Otherwise we'll end up jumping through a NULL-pointer once we try to look up the visual or config for the shared context. https://bugs.freedesktop.org/show_bug.cgi?id=14245
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/glxcmds.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 6063cf0..34fbecf 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -1766,6 +1766,15 @@ static int __glXQueryContextInfo(Display * dpy, GLXContext ctx)
unsigned i;
_XRead(dpy, (char *) propList, nPropListBytes);
+
+ /* Look up screen first so we can look up visuals/fbconfigs later */
+ pProp = propList;
+ for (i = 0; i < numValues; i++, pProp += 2)
+ if (pProp[0] == GLX_SCREEN) {
+ ctx->screen = pProp[1];
+ ctx->psc = GetGLXScreenConfigs(dpy, ctx->screen);
+ }
+
pProp = propList;
for (i = 0; i < numValues; i++) {
switch (*pProp++) {
@@ -1776,9 +1785,6 @@ static int __glXQueryContextInfo(Display * dpy, GLXContext ctx)
ctx->mode =
_gl_context_modes_find_visual(ctx->psc->visuals, *pProp++);
break;
- case GLX_SCREEN:
- ctx->screen = *pProp++;
- break;
case GLX_FBCONFIG_ID:
ctx->mode =
_gl_context_modes_find_fbconfig(ctx->psc->configs,
@@ -1787,6 +1793,7 @@ static int __glXQueryContextInfo(Display * dpy, GLXContext ctx)
case GLX_RENDER_TYPE:
ctx->renderType = *pProp++;
break;
+ case GLX_SCREEN:
default:
pProp++;
continue;