Only query fbconfig for valid non-NULL context. Closes #1082

This commit is contained in:
baldurk
2018-08-17 19:49:53 +01:00
parent 5c58146a95
commit 4d619d9b17
+14 -9
View File
@@ -367,18 +367,23 @@ HOOK_EXPORT Bool glXMakeContextCurrent(Display *dpy, GLXDrawable draw, GLXDrawab
data.wnd = draw;
data.ctx = ctx;
int fbconfigid = -1;
GLX.glXQueryContext(dpy, ctx, GLX_FBCONFIG_ID, &fbconfigid);
GLXFBConfig *config = NULL;
int attribs[] = {GLX_FBCONFIG_ID, fbconfigid, 0};
if(ctx)
{
int fbconfigid = -1;
GLX.glXQueryContext(dpy, ctx, GLX_FBCONFIG_ID, &fbconfigid);
int numElems = 0;
GLXFBConfig *config = GLX.glXChooseFBConfig(dpy, DefaultScreen(dpy), attribs, &numElems);
int attribs[] = {GLX_FBCONFIG_ID, fbconfigid, 0};
if(config)
data.cfg = GLX.glXGetVisualFromFBConfig(dpy, *config);
else
data.cfg = NULL;
int numElems = 0;
config = GLX.glXChooseFBConfig(dpy, DefaultScreen(dpy), attribs, &numElems);
if(config)
data.cfg = GLX.glXGetVisualFromFBConfig(dpy, *config);
else
data.cfg = NULL;
}
glxhook.driver.ActivateContext(data);