drisw_glx: handle XGetGeometry failure in get_drawable_geometry

When glXBindTexImageEXT is called on a drawable whose Window has been
destroyed, XGetGeometry fails. The return value was not checked, leaving
width/height uninitialized and causing a crash downstream. Check the
return value and set w/h to 0 on failure.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Assisted-by: DeepSeek V4 Flash

Closes #327

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42192>
This commit is contained in:
Julien Schueller 2026-06-11 18:48:55 +02:00 committed by Marge Bot
parent 1e9fd4ca5b
commit ced5ef2cfb

View file

@ -160,6 +160,7 @@ get_drawable_geometry(struct dri_drawable * draw,
drawable = pdraw->xDrawable;
uw = uh = 0;
XGetGeometry(dpy, drawable, &root, x, y, &uw, &uh, &bw, &depth);
*w = uw;
*h = uh;