xlib: fix glXDestroyContext in Gallium frontends

when glx is built with -Dglx=xlib, the mishandle in
glXDestroyContext causes glmark2 to exit unexpectedly.

Error: Glmark2 needs OpenGL(ES) version >= 2.0 to run (but version string is: '(null)')!
Error: Failed to add vertex shader from file None:
Error:   Failed to create the new program
[build] <default>: Set up failed

Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3985

Signed-off-by: Luc Ma <luc@sietium.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21067>
This commit is contained in:
Luc Ma 2023-02-02 19:29:45 +08:00 committed by Luc Ma
parent 8f928a95e1
commit abe6d750e5

View file

@ -1392,8 +1392,14 @@ glXQueryExtension( Display *dpy, int *errorBase, int *eventBase )
PUBLIC void PUBLIC void
glXDestroyContext( Display *dpy, GLXContext ctx ) glXDestroyContext( Display *dpy, GLXContext ctx )
{ {
if (ctx) { GLXContext glxCtx = ctx;
GLXContext glxCtx = ctx;
if (glxCtx == NULL || glxCtx->xid == None)
return;
if (ctx->currentDpy) {
ctx->xid = None;
} else {
(void) dpy; (void) dpy;
XMesaDestroyContext( glxCtx->xmesaContext ); XMesaDestroyContext( glxCtx->xmesaContext );
XMesaGarbageCollect(); XMesaGarbageCollect();