glx: Increment dpy->request before issuing an error that had no request
authorDaniel van Vugt <daniel.van.vugt@canonical.com>
Tue, 12 Sep 2023 08:01:15 +0000 (16:01 +0800)
committerMarge Bot <emma+marge@anholt.net>
Thu, 14 Sep 2023 16:33:29 +0000 (16:33 +0000)
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>

src/glx/glx_pbuffer.c

index 0b3cdfa..d95a3e9 100644 (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;