xlib: clear currentDpy when releasing the current context

After abe6d750e5, 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: abe6d750e5 ("xlib: fix glXDestroyContext in Gallium frontends")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14947
Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 447a1d2e8d)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
This commit is contained in:
Mixie 2026-03-14 20:31:22 +03:00 committed by Eric Engestrom
parent 871a933cac
commit c72a0457e1
2 changed files with 3 additions and 1 deletions

View file

@ -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

View file

@ -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;