From 67d06e0fe468dca22847aa14d3f917128f89f9cf Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Tue, 21 Feb 2006 15:33:05 -0800 Subject: [PATCH] If we have not actually put the buffer back, deferred invariants may not hold. This is OK. --- src/xcl/xcblock.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/xcl/xcblock.c b/src/xcl/xcblock.c index 7ce4a83d..fc0564b8 100644 --- a/src/xcl/xcblock.c +++ b/src/xcl/xcblock.c @@ -41,11 +41,17 @@ static void _XUnlockDisplay(Display *dpy) { --dpy->xcl->lock_count; _XPutXCBBufferIf(dpy, _XBufferUnlocked); - assert(XCBGetRequestSent(XCBConnectionOfDisplay(dpy)) == 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); + /* If we're unlocking all the way, make sure that our deferred + * invariants hold. */ + if(!dpy->xcl->lock_count) + { + assert(XCBGetRequestSent(XCBConnectionOfDisplay(dpy)) == 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); + } pthread_mutex_unlock(XCBGetIOLock(XCBConnectionOfDisplay(dpy))); }