From c72a0457e1a0d907542acccfcb8fcb277375fb4e 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 (cherry picked from commit 447a1d2e8d5f8a58b6aef7b74d1f720a8a4b8c02) Part-of: --- .pick_status.json | 2 +- src/gallium/frontends/glx/xlib/glx_api.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 0f42c10b83b..d8311a904a1 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -3454,7 +3454,7 @@ "description": "xlib: clear currentDpy when releasing the current context", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "abe6d750e58d371624de75f4bad365c61e0196c1", "notes": null 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;