If xcb_poll_for_reply fails to find a reply, poll_for_response would always return NULL. However, xcb_poll_for_reply may have read events from the display connection while looking for a reply. In that case, returning NULL from poll_for_response is wrong and can result in the client hanging, e.g. because it returns to waiting for the display connection file descriptor becoming readable after XPending incorrectly returned 0 pending events.
The solution is to call poll_for_event again after xcb_poll_for_reply returned 0. This will return the first of any events read by xcb_poll_for_reply.
Fixes issue #79 (closed).