On Mon, 28 Jun 2010 19:22:39 -0700 Keith Packard <[email protected]> wrote:
> On Mon, 28 Jun 2010 19:14:41 -0700, Jesse Barnes <[email protected]> > wrote: > > > Thanks. Do you want to apply it with that change or shall I send an > > update? > > Update with Rb line attached would be most excellent. We may want to see > if others have comments before I apply it to master. Here you go (assuming no objections). Thanks, -- Jesse Barnes, Intel Open Source Technology Center >From 2c1845751c96f260ec6650ef3dc9d95785e9c651 Mon Sep 17 00:00:00 2001 From: Jesse Barnes <[email protected]> Date: Mon, 28 Jun 2010 20:11:18 -0700 Subject: [PATCH] OS support: fix writeable client vs IgnoreClient behavior When ResetCurrentRequest is called, or IgnoreClient is called when a client has input pending, IgnoredClientsWithInput will be set. However, a subsequent IgnoreClient request will clear the client fd from that fd set, potentially causing the client to hang. So add an Ignore/Attend count, and only apply the ignore logic on the first ignore and the attend logic on the last attend. This is consistent with the comments for these functions; callers must pair them. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=27035. Reviewed-by: Keith Packard <[email protected]> Signed-off-by: Jesse Barnes <[email protected]> --- include/dixstruct.h | 1 + os/connection.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/include/dixstruct.h b/include/dixstruct.h index 696b793..568ea1f 100644 --- a/include/dixstruct.h +++ b/include/dixstruct.h @@ -99,6 +99,7 @@ typedef struct _Client { int clientGone; int noClientException; /* this client died or needs to be * killed */ + int ignoreCount; /* count for Attend/IgnoreClient */ SaveSetElt *saveSet; int numSaved; void *unused_screenPrivate[16]; diff --git a/os/connection.c b/os/connection.c index 61ba72a..dd48c11 100644 --- a/os/connection.c +++ b/os/connection.c @@ -1148,6 +1148,11 @@ IgnoreClient (ClientPtr client) int connection = oc->fd; isItTimeToYield = TRUE; + + client->ignoreCount++; + if (client->ignoreCount > 1) + return; + if (!GrabInProgress || FD_ISSET(connection, &AllClients)) { if (FD_ISSET (connection, &ClientsWithInput)) @@ -1181,6 +1186,11 @@ AttendClient (ClientPtr client) { OsCommPtr oc = (OsCommPtr)client->osPrivate; int connection = oc->fd; + + client->ignoreCount--; + if (client->ignoreCount) + return; + if (!GrabInProgress || GrabInProgress == client->index || FD_ISSET(connection, &GrabImperviousClients)) { -- 1.6.6.1 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
