glx: Simplify error handling in glXImportContextEXT
authorAdam Jackson <ajax@redhat.com>
Tue, 1 Dec 2020 15:49:03 +0000 (10:49 -0500)
committerMarge Bot <eric+marge@anholt.net>
Wed, 2 Dec 2020 16:07:27 +0000 (16:07 +0000)
The GLXIsDirect request will throw GLXBadContext for us if it needs to,
so we can avoid synthesizing an error on the client side.

Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7859>

src/glx/glxcmds.c

index 4b96b38..cf546cc 100644 (file)
@@ -1421,15 +1421,9 @@ glXImportContextEXT(Display *dpy, GLXContextID contextID)
     *     context then no error is generated but glXImportContextEXT returns
     *     NULL."
     *
-    * If contextID is None, generate BadContext on the client-side.  Other
-    * sorts of invalid contexts will be detected by the server in the
-    * __glXIsDirect call.
+    * We can handle both conditions with the __glXIsDirect call, because
+    * passing None to a GLXIsDirect request will throw GLXBadContext.
     */
-   if (contextID == None) {
-      __glXSendError(dpy, GLXBadContext, contextID, X_GLXIsDirect, false);
-      return NULL;
-   }
-
    if (__glXIsDirect(dpy, contextID, NULL))
       return NULL;