diff options
author | Jamey Sharp <jamey@minilop.net> | 2010-06-19 10:44:55 -0700 |
---|---|---|
committer | Jamey Sharp <jamey@minilop.net> | 2010-06-19 10:55:09 -0700 |
commit | c115095d7f2bc4f5a4fb26380e3698fefdad7611 (patch) | |
tree | 8f18fcead3afb113eed0d8e874ef53722e387022 /src | |
parent | a25ae169862ab9b76daf259613b37c6b07bc2ef2 (diff) |
poll_for_response: Really handle xcb_poll_for_reply getting a reply.
Don't lose async replies. That's bad.
`xlsfonts -l`, which uses XListFontsWithInfo, worked fine, because the
_XReply path worked; that path waited for replies, rather than polling.
However, XRecordProcessReplies, which does nothing but call XPending,
relied on the event-handling path to process async replies, and that was
busted.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=28595
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/xcb_io.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/xcb_io.c b/src/xcb_io.c index dac7622c..0350bb2d 100644 --- a/src/xcb_io.c +++ b/src/xcb_io.c @@ -232,19 +232,25 @@ static xcb_generic_reply_t *poll_for_response(Display *dpy) void *response; xcb_generic_error_t *error; PendingRequest *req; - while(!(response = poll_for_event(dpy)) && - (req = dpy->xcb->pending_requests) && + + response = poll_for_event(dpy); + if (response) + return response; + + while((req = dpy->xcb->pending_requests) && !req->reply_waiter && xcb_poll_for_reply(dpy->xcb->connection, req->sequence, &response, &error)) { assert(XLIB_SEQUENCE_COMPARE(req->sequence, <=, dpy->request)); dpy->last_request_read = req->sequence; - if(!response) - dequeue_pending_request(dpy, req); + if(response) + return response; + dequeue_pending_request(dpy, req); if(error) return (xcb_generic_reply_t *) error; } - return response; + + return NULL; } static void handle_response(Display *dpy, xcb_generic_reply_t *response, Bool in_XReply) |