Commit 28e33ae6 authored by Jesse Barnes's avatar Jesse Barnes Committed by Keith Packard

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's avatarKeith Packard <keithp@keithp.com>
Reviewed-by: Daniel Stone's avatarDaniel Stone <daniel@fooishbar.org>
Signed-off-by: Jesse Barnes's avatarJesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
parent 018c878e
......@@ -98,6 +98,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;
int (**requestVector) (
......
......@@ -1147,6 +1147,10 @@ IgnoreClient (ClientPtr client)
OsCommPtr oc = (OsCommPtr)client->osPrivate;
int connection = oc->fd;
client->ignoreCount++;
if (client->ignoreCount > 1)
return;
isItTimeToYield = TRUE;
if (!GrabInProgress || FD_ISSET(connection, &AllClients))
{
......@@ -1181,6 +1185,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))
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment