diff options
Diffstat (limited to 'hw/xfree86/dri2/dri2.c')
-rw-r--r-- | hw/xfree86/dri2/dri2.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index d0aecb4bd..15d2e7a2e 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -255,7 +255,8 @@ DRI2LookupClientDrawableRef(DRI2DrawablePtr pPriv, ClientPtr client, XID id) DRI2DrawableRefPtr ref; list_for_each_entry(ref, &pPriv->reference_list, link) { - if (CLIENT_ID(ref->dri2_id) == client->index && ref->id == id) + if (CLIENT_ID(ref->dri2_id) == client->index && + (id == 0 || ref->id == id)) return ref; } return NULL; @@ -740,22 +741,24 @@ DRI2WaitMSCComplete(int client_index, DRI2DrawablePtr pPriv, int frame, unsigned int tv_sec, unsigned int tv_usec) { ClientPtr client = clients[client_index]; + DRI2DrawableRefPtr ref = DRI2LookupClientDrawableRef(pPriv, client, 0); + ClientPtr blockedClient = pPriv->blockedClient; + pPriv->blockedClient = NULL; + pPriv->blockedOnMsc = FALSE; pPriv->refcnt--; - if (pPriv->refcnt == 0) { - DRI2DrawableGone(pPriv, 0); + if (ref == NULL) { + if (pPriv->refcnt == 0) + DRI2DrawableGone(pPriv, 0); return; } ProcDRI2WaitMSCReply(client, ((CARD64)tv_sec * 1000000) + tv_usec, frame, pPriv->swap_count); - if (pPriv->blockedClient) - AttendClient(pPriv->blockedClient); - - pPriv->blockedClient = NULL; - pPriv->blockedOnMsc = FALSE; + if (blockedClient) + AttendClient(blockedClient); } static void @@ -809,6 +812,7 @@ DRI2SwapComplete(int client_index, DRI2DrawablePtr pPriv, int frame, { ClientPtr client = clients[client_index]; DRI2SwapCompleteDataPtr pSwapData = swap_data; + DRI2DrawableRefPtr ref = DRI2LookupClientDrawableRef(pPriv, client, 0); DrawablePtr pDraw = pPriv->drawable; CARD64 ust = 0; @@ -816,6 +820,9 @@ DRI2SwapComplete(int client_index, DRI2DrawablePtr pPriv, int frame, pPriv->swap_count++; pPriv->refcnt--; + if (ref == NULL) + goto out; + if (pDraw) { BoxRec box; RegionRec region; @@ -839,6 +846,7 @@ DRI2SwapComplete(int client_index, DRI2DrawablePtr pPriv, int frame, DRI2WakeClient(client, pPriv, frame, tv_sec, tv_usec); +out: free_swap_complete_data(pPriv, pSwapData); if (pPriv->refcnt == 0) |