diff options
author | Kyle Brenneman <kbrenneman@nvidia.com> | 2016-04-05 13:02:02 -0600 |
---|---|---|
committer | Kyle Brenneman <kbrenneman@nvidia.com> | 2016-04-06 10:49:47 -0600 |
commit | 5a69af6f77dd68fed4d54137c155676478dcccc3 (patch) | |
tree | 1e00925223cee86fce2faa31272152977c3bc332 | |
parent | cc0892bb1ce9940f415d4c6bddc3cef5b64a378a (diff) |
GLX: Ignore passing NULL to glXDestroyContext
If glXDestroyContext is called with NULL for the GLXContext, then it will now
report an error using glvndAppErrorCheckReportError but it won't generate a
GLXBadContext error.
Some existing drivers (NVIDIA, Mesa, and possibly others) will just silently
return in that case, and some applications depend on that behavior.
-rw-r--r-- | src/GLX/libglx.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/GLX/libglx.c b/src/GLX/libglx.c index 15b23ef..82f118a 100644 --- a/src/GLX/libglx.c +++ b/src/GLX/libglx.c @@ -268,7 +268,17 @@ PUBLIC GLXContext glXCreateNewContext(Display *dpy, GLXFBConfig config, PUBLIC void glXDestroyContext(Display *dpy, GLXContext context) { - __GLXvendorInfo *vendor = CommonDispatchContext(dpy, context, X_GLXDestroyContext); + __GLXvendorInfo *vendor; + + if (context == NULL) { + // Some drivers will just return without generating an error if the app + // passes NULL for a context, and unfortunately there are some broken + // applications that depend on that behavior. + glvndAppErrorCheckReportError("glXDestroyContext called with NULL for context\n"); + return; + } + + vendor = CommonDispatchContext(dpy, context, X_GLXDestroyContext); if (vendor != NULL) { __glXRemoveVendorContextMapping(dpy, context); vendor->staticDispatch.destroyContext(dpy, context); |