[PATCH] fixed possible accidental return of error indication

Bart Massey bart at cs.pdx.edu
Sun Jan 25 22:28:55 PST 2009


---
 src/xcb_xid.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/xcb_xid.c b/src/xcb_xid.c
index 3df5dbe..16ad65b 100644
--- a/src/xcb_xid.c
+++ b/src/xcb_xid.c
@@ -40,7 +40,12 @@ uint32_t xcb_generate_id(xcb_connection_t *c)
     if(c->has_error)
         return -1;
     pthread_mutex_lock(&c->xid.lock);
-    if(c->xid.last >= c->xid.max - c->xid.inc + 1)
+    /* XXX the second disjunct asks for a new range if we're
+       about to return (uint32_t)-1, which would indicate an
+       error even though no such indication was intended.  I
+       don't know what else to do here... */
+    if(c->xid.last >= c->xid.max - c->xid.inc + 1 ||
+       (c->xid.last + c->xid.inc) | c->xid.base == -1)
     {
         xcb_xc_misc_get_xid_range_reply_t *range;
         assert(c->xid.last == c->xid.max);
-- 
1.5.6.5


------- =_aaaaaaaaaa0--


More information about the Xcb mailing list