[Xcb-commit] libxcb: src

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Mar 2 18:19:40 UTC 2020


 src/xcb.h     |    2 +-
 src/xcb_xid.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 704e0a91b1dece9a4cce7cfe8beaeb86a5e14267
Author: Eduardo Sánchez Muñoz <esm at eduardosm.net>
Date:   Mon Mar 2 18:59:45 2020 +0100

    Use the 'present' field to properly check that the XC-MISC
    extension is available in xcb_generate_id.
    
    Also document the returned value when xcb_generate_id fails.

diff --git a/src/xcb.h b/src/xcb.h
index dd7f532..09e123e 100644
--- a/src/xcb.h
+++ b/src/xcb.h
@@ -591,7 +591,7 @@ xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *display, xcb
 /**
  * @brief Allocates an XID for a new object.
  * @param c The connection.
- * @return A newly allocated XID.
+ * @return A newly allocated XID, or -1 on failure.
  *
  * Allocates an XID for a new object. Typically used just prior to
  * various object creation functions, such as xcb_create_window.
diff --git a/src/xcb_xid.c b/src/xcb_xid.c
index 79a9a27..ebe41a1 100644
--- a/src/xcb_xid.c
+++ b/src/xcb_xid.c
@@ -55,7 +55,7 @@ uint32_t xcb_generate_id(xcb_connection_t *c)
             /* check for extension */
             const xcb_query_extension_reply_t *xc_misc_reply =
               xcb_get_extension_data(c, &xcb_xc_misc_id);
-            if (!xc_misc_reply) {
+            if (!xc_misc_reply || !xc_misc_reply->present) {
                 pthread_mutex_unlock(&c->xid.lock);
                 return -1;
             }


More information about the xcb-commit mailing list