glx: Increment dpy->request before issuing an error that had no request

This ensures the sequence number is unique and recent enough for callers
of `glXQueryDrawable` using `XNextRequest` to selectively trap errors.
The same approach is already used in `glXCreateContextAttribsARB`.

Suggested-by: Sebastian Keller <skeller@gnome.org>
Related-to: https://gitlab.gnome.org/GNOME/mutter/-/issues/3007
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25173>
This commit is contained in:
Daniel van Vugt 2023-09-12 16:01:15 +08:00 committed by Marge Bot
parent 73fec95358
commit bb06db5a62

View file

@ -239,6 +239,7 @@ __glXGetDrawableAttribute(Display * dpy, GLXDrawable drawable,
* generated."
*/
if (drawable == 0) {
XNoOp(dpy);
__glXSendError(dpy, GLXBadDrawable, 0, X_GLXGetDrawableAttributes, false);
return 0;
}
@ -269,6 +270,7 @@ __glXGetDrawableAttribute(Display * dpy, GLXDrawable drawable,
if (pdraw == NULL || gc == &dummyContext || gc->currentDpy != dpy ||
(gc->currentDrawable != drawable &&
gc->currentReadable != drawable)) {
XNoOp(dpy);
__glXSendError(dpy, GLXBadDrawable, drawable,
X_GLXGetDrawableAttributes, false);
return 0;