diff options
author | Jamey Sharp <jamey@minilop.net> | 2010-05-15 12:31:34 -0700 |
---|---|---|
committer | Jamey Sharp <jamey@minilop.net> | 2010-05-19 12:32:34 -0700 |
commit | 4b9600a4167427a8fe88bca9b738c9a99cac9469 (patch) | |
tree | a22ef3ebd07d5561041ae1a2483f279eaeaa0e6b /Xext | |
parent | ee9cd2df4a5af66c6b7073563785b8aef61fcdb8 (diff) |
Make WriteEventsToClient/WriteToClient no-op on fake or dead clients.
This matches the test in TryClientEvents, and is a superset of tests
done by the callers of these functions. The consequence of forgetting
these tests is a server crash, so they're always desirable. In my
opinion, it's better to not require the callers to remember to do these
checks.
For callers that don't do very much work before calling WriteToClient or
WriteEventsToClient, I've removed the redundant checks.
hw/xquartz/xpr/appledri.c has an interesting case: While its check for
"client == NULL" appears redundant with the test in WriteEventsToClient,
it dereferences client to get the sequence number.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=27497
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'Xext')
-rw-r--r-- | Xext/saver.c | 2 | ||||
-rw-r--r-- | Xext/security.c | 14 | ||||
-rw-r--r-- | Xext/shape.c | 2 | ||||
-rw-r--r-- | Xext/sync.c | 9 | ||||
-rw-r--r-- | Xext/xcalibrate.c | 3 |
5 files changed, 9 insertions, 21 deletions
diff --git a/Xext/saver.c b/Xext/saver.c index 4b43a305a..42fc6328b 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -500,8 +500,6 @@ SendScreenSaverNotify (ScreenPtr pScreen, int state, Bool forced) for (pEv = pPriv->events; pEv; pEv = pEv->next) { client = pEv->client; - if (client->clientGone) - continue; if (!(pEv->mask & mask)) continue; ev.type = ScreenSaverNotify + ScreenSaverEventBase; diff --git a/Xext/security.c b/Xext/security.c index 7995ff2f3..16aac05e4 100644 --- a/Xext/security.c +++ b/Xext/security.c @@ -199,15 +199,11 @@ SecurityDeleteAuthorization( { /* send revocation event event */ ClientPtr client = rClient(pEventClient); - - if (!client->clientGone) - { - xSecurityAuthorizationRevokedEvent are; - are.type = SecurityEventBase + XSecurityAuthorizationRevoked; - are.sequenceNumber = client->sequence; - are.authId = pAuth->id; - WriteEventsToClient(client, 1, (xEvent *)&are); - } + xSecurityAuthorizationRevokedEvent are; + are.type = SecurityEventBase + XSecurityAuthorizationRevoked; + are.sequenceNumber = client->sequence; + are.authId = pAuth->id; + WriteEventsToClient(client, 1, (xEvent *)&are); FreeResource(pEventClient->resource, RT_NONE); } diff --git a/Xext/shape.c b/Xext/shape.c index cd756583c..10437f496 100644 --- a/Xext/shape.c +++ b/Xext/shape.c @@ -941,8 +941,6 @@ SendShapeNotify (WindowPtr pWin, int which) } for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) { client = pShapeEvent->client; - if (client == serverClient || client->clientGone) - continue; se.type = ShapeNotify + ShapeEventBase; se.kind = which; se.window = pWin->drawable.id; diff --git a/Xext/sync.c b/Xext/sync.c index d46087a68..3729f1bf2 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -390,17 +390,14 @@ SyncSendAlarmNotifyEvents(SyncAlarm *pAlarm) ane.state = pAlarm->state; /* send to owner */ - if (pAlarm->events && !pAlarm->client->clientGone) + if (pAlarm->events) WriteEventsToClient(pAlarm->client, 1, (xEvent *) &ane); /* send to other interested clients */ for (pcl = pAlarm->pEventClients; pcl; pcl = pcl->next) { - if (!pcl->client->clientGone) - { - ane.sequenceNumber = pcl->client->sequence; - WriteEventsToClient(pcl->client, 1, (xEvent *) &ane); - } + ane.sequenceNumber = pcl->client->sequence; + WriteEventsToClient(pcl->client, 1, (xEvent *) &ane); } } diff --git a/Xext/xcalibrate.c b/Xext/xcalibrate.c index 364b92ac4..865938497 100644 --- a/Xext/xcalibrate.c +++ b/Xext/xcalibrate.c @@ -59,8 +59,7 @@ xcalibrate_event_hook (int x, int y, int pressure, void *closure) ev.y = y; ev.pressure = pressure; - if (!pClient->clientGone) - WriteEventsToClient (pClient, 1, (xEvent *) &ev); + WriteEventsToClient (pClient, 1, (xEvent *) &ev); } static int |