mirror of
https://gitlab.freedesktop.org/xorg/lib/libx11.git
synced 2026-05-08 06:48:05 +02:00
Xlib/XCB: Avoid re-crashing after _XIOError.
Commit by Josh Triplett and Jamey Sharp.
This commit is contained in:
parent
6b81cbbedf
commit
740ead2351
2 changed files with 20 additions and 7 deletions
|
|
@ -186,6 +186,8 @@ static void process_responses(Display *dpy, int wait_for_first_event, xcb_generi
|
|||
|
||||
int _XEventsQueued(Display *dpy, int mode)
|
||||
{
|
||||
if(dpy->flags & XlibDisplayIOError)
|
||||
return 0;
|
||||
if(dpy->xcb->event_owner != XlibOwnsEventQueue)
|
||||
return 0;
|
||||
|
||||
|
|
@ -202,6 +204,8 @@ int _XEventsQueued(Display *dpy, int mode)
|
|||
*/
|
||||
void _XReadEvents(Display *dpy)
|
||||
{
|
||||
if(dpy->flags & XlibDisplayIOError)
|
||||
return;
|
||||
_XSend(dpy, 0, 0);
|
||||
if(dpy->xcb->event_owner != XlibOwnsEventQueue)
|
||||
return;
|
||||
|
|
@ -219,6 +223,8 @@ void _XReadEvents(Display *dpy)
|
|||
void _XSend(Display *dpy, const char *data, long size)
|
||||
{
|
||||
xcb_connection_t *c = dpy->xcb->connection;
|
||||
if(dpy->flags & XlibDisplayIOError)
|
||||
return;
|
||||
|
||||
assert(!dpy->xcb->request_extra);
|
||||
dpy->xcb->request_extra = data;
|
||||
|
|
@ -356,6 +362,9 @@ Status _XReply(Display *dpy, xReply *rep, int extra, Bool discard)
|
|||
|
||||
assert(!dpy->xcb->reply_data);
|
||||
|
||||
if(dpy->flags & XlibDisplayIOError)
|
||||
return 0;
|
||||
|
||||
/* Internals of UnlockDisplay done by hand here, so that we can
|
||||
insert_pending_request *after* we _XPutXCBBuffer, but before we
|
||||
unlock the display. */
|
||||
|
|
|
|||
|
|
@ -19,18 +19,22 @@ static void _XCBLockDisplay(Display *dpy)
|
|||
dpy->xcb->lock_fns.lock_display(dpy);
|
||||
if(!dpy->lock || dpy->lock->locking_level == 0)
|
||||
xcb_xlib_lock(dpy->xcb->connection);
|
||||
_XGetXCBBuffer(dpy);
|
||||
if(!(dpy->flags & XlibDisplayIOError))
|
||||
_XGetXCBBuffer(dpy);
|
||||
}
|
||||
|
||||
static void _XCBUnlockDisplay(Display *dpy)
|
||||
{
|
||||
_XPutXCBBuffer(dpy);
|
||||
assert(dpy->xcb->partial_request == 0);
|
||||
assert(xcb_get_request_sent(dpy->xcb->connection) == dpy->request);
|
||||
if(!(dpy->flags & XlibDisplayIOError))
|
||||
{
|
||||
_XPutXCBBuffer(dpy);
|
||||
assert(dpy->xcb->partial_request == 0);
|
||||
assert(xcb_get_request_sent(dpy->xcb->connection) == dpy->request);
|
||||
|
||||
/* Traditional Xlib does this in _XSend; see the Xlib/XCB version
|
||||
* of that function for why we do it here instead. */
|
||||
_XSetSeqSyncFunction(dpy);
|
||||
/* Traditional Xlib does this in _XSend; see the Xlib/XCB version
|
||||
* of that function for why we do it here instead. */
|
||||
_XSetSeqSyncFunction(dpy);
|
||||
}
|
||||
|
||||
if(!dpy->lock || dpy->lock->locking_level == 0)
|
||||
xcb_xlib_unlock(dpy->xcb->connection);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue