summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuc Ma <luc@sietium.com>2023-02-02 19:29:45 +0800
committerLuc Ma <onion0709@gmail.com>2023-02-04 22:25:09 +0000
commitabe6d750e58d371624de75f4bad365c61e0196c1 (patch)
tree7a7922ea3b99b9bcbbb34e4731cde76a5105da43 /src
parent8f928a95e167423320af711b21270a8212f34628 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/frontends/glx/xlib/glx_api.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gallium/frontends/glx/xlib/glx_api.c b/src/gallium/frontends/glx/xlib/glx_api.c
index 86dd86ebd24..63163a8c523 100644
--- a/src/gallium/frontends/glx/xlib/glx_api.c
+++ b/src/gallium/frontends/glx/xlib/glx_api.c
@@ -1392,8 +1392,14 @@ glXQueryExtension( Display *dpy, int *errorBase, int *eventBase )
PUBLIC void
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;
XMesaDestroyContext( glxCtx->xmesaContext );
XMesaGarbageCollect();