From 99e30237252fea7d17d4126a929dafb3766e936c Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 24 Apr 2013 14:40:31 +1000 Subject: [PATCH 28/35] Move TouchListenerGone call to CloseDownClient TouchListenerGone cleans up if a client disappears. Having this in FreeGrab() triggers cyclic removal of grabs, emitting wrong events. In particular, it would clean up a passive grab record while that grab is active. Move it to CloseDownClient() instead, cleaning up before we go. Signed-off-by: Peter Hutterer (cherry picked from commit 5b00fc52270e9cfdfe7ac1838a21defe50fc3d31) --- dix/dispatch.c | 1 + dix/grabs.c | 3 --- dix/touch.c | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/dix/dispatch.c b/dix/dispatch.c index 8d61735..20f2414 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -3398,6 +3398,7 @@ CloseDownClient(ClientPtr client) clientinfo.setup = (xConnSetup *) NULL; CallCallbacks((&ClientStateCallback), (pointer) &clientinfo); } + TouchListenerGone(client->clientAsMask); FreeClientResources(client); /* Disable client ID tracking. This must be done after * ClientStateCallback. */ diff --git a/dix/grabs.c b/dix/grabs.c index f46a6b2..b254ddc 100644 --- a/dix/grabs.c +++ b/dix/grabs.c @@ -257,9 +257,6 @@ FreeGrab(GrabPtr pGrab) { BUG_RETURN(!pGrab); - if (pGrab->grabtype == XI2 && pGrab->type == XI_TouchBegin) - TouchListenerGone(pGrab->resource); - free(pGrab->modifiersDetail.pMask); free(pGrab->detail.pMask); diff --git a/dix/touch.c b/dix/touch.c index 0099914..110b1cc 100644 --- a/dix/touch.c +++ b/dix/touch.c @@ -989,11 +989,11 @@ TouchListenerGone(XID resource) continue; for (j = 0; j < ti->num_listeners; j++) { - if (ti->listeners[j].listener != resource) + if (CLIENT_BITS(ti->listeners[j].listener) != resource) continue; nev = GetTouchOwnershipEvents(events, dev, ti, XIRejectTouch, - resource, 0); + ti->listeners[j].listener, 0); for (k = 0; k < nev; k++) mieqProcessDeviceEvent(dev, events + k, NULL); -- 1.8.2.1