From 447a1d2e8d5f8a58b6aef7b74d1f720a8a4b8c02 Mon Sep 17 00:00:00 2001 From: Mixie <97407744+Maxi741cv@users.noreply.github.com> Date: Sat, 14 Mar 2026 20:31:22 +0300 Subject: [PATCH] xlib: clear currentDpy when releasing the current context After abe6d750e58d, glXDestroyContext() can defer destruction by marking the context with xid == None while it is still current. However, the release-current path did not clear current->currentDpy, so a context that had already been marked for deletion could remain associated with a display after unbinding. Fixes: abe6d750e58d ("xlib: fix glXDestroyContext in Gallium frontends") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14947 Reviewed-by: Adam Jackson Part-of: --- src/gallium/frontends/glx/xlib/glx_api.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/frontends/glx/xlib/glx_api.c b/src/gallium/frontends/glx/xlib/glx_api.c index 9ee3c94882b..e1d98369d09 100644 --- a/src/gallium/frontends/glx/xlib/glx_api.c +++ b/src/gallium/frontends/glx/xlib/glx_api.c @@ -1236,6 +1236,8 @@ glXMakeContextCurrent( Display *dpy, GLXDrawable draw, } else if (!ctx && !draw && !read) { /* release current context w/out assigning new one. */ + if (current) + current->currentDpy = NULL; XMesaMakeCurrent2( NULL, NULL, NULL ); SetCurrentContext(NULL); return True;