dix: ensure work queues are cleared on reset

If the server resets, most client workqueues are cleaned up as the
clients are killed.

The one exception is the server's client, which is exempt from
the killing spree.

If that client has a queued work procedure active, it won't get
cleared on reset.

This commit ensures it gets cleared too.

(cherry picked from commit 8738ce85df)

Fixes: xorg/xserver#670
This commit is contained in:
Ray Strode 2018-11-16 14:36:55 -05:00 committed by Adam Jackson
parent 94f036d412
commit 34553f5026
3 changed files with 17 additions and 0 deletions

View File

@ -507,6 +507,19 @@ InitBlockAndWakeupHandlers(void)
WorkQueuePtr workQueue;
static WorkQueuePtr *workQueueLast = &workQueue;
void
ClearWorkQueue(void)
{
WorkQueuePtr q, *p;
p = &workQueue;
while ((q = *p)) {
*p = q->next;
free(q);
}
workQueueLast = p;
}
void
ProcessWorkQueue(void)
{

View File

@ -342,6 +342,8 @@ dix_main(int argc, char *argv[], char *envp[])
DeleteCallbackManager();
ClearWorkQueue();
if (dispatchException & DE_TERMINATE) {
CloseWellKnownConnections();
}

View File

@ -240,6 +240,8 @@ extern _X_EXPORT void RemoveBlockAndWakeupHandlers(ServerBlockHandlerProcPtr blo
extern _X_EXPORT void InitBlockAndWakeupHandlers(void);
extern _X_EXPORT void ClearWorkQueue(void);
extern _X_EXPORT void ProcessWorkQueue(void);
extern _X_EXPORT void ProcessWorkQueueZombies(void);