From 24c42813d8c2d9ced7233bf97a0026f72067d917 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 3 May 2019 23:15:02 +0200 Subject: NXdispatch.c: call upstream CloseDownClient() remove ~80 duplicate lines --- nx-X11/programs/Xserver/dix/dispatch.c | 8 ++- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 85 +------------------------ 2 files changed, 6 insertions(+), 87 deletions(-) diff --git a/nx-X11/programs/Xserver/dix/dispatch.c b/nx-X11/programs/Xserver/dix/dispatch.c index 0d4a80e2c..ef3d7b021 100644 --- a/nx-X11/programs/Xserver/dix/dispatch.c +++ b/nx-X11/programs/Xserver/dix/dispatch.c @@ -3480,11 +3480,14 @@ InitProcVectors(void) * then killed again, the client is really destroyed. *********************/ -#ifndef NXAGENT_SERVER char dispatchExceptionAtReset = DE_RESET; void -CloseDownClient(register ClientPtr client) +#ifdef NXAGENT_SERVER +xorg_CloseDownClient(ClientPtr client) +#else +CloseDownClient(ClientPtr client) +#endif { Bool really_close_down = client->clientGone || client->closeDownMode == DestroyAll; @@ -3569,7 +3572,6 @@ CloseDownClient(register ClientPtr client) currentMaxClients--; } } -#endif /* NXAGENT_SERVER */ static void KillAllClients() diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index 9e365f372..c427c05f2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -128,8 +128,6 @@ Equipment Corporation. const int nxagentMaxFontNames = 10000; -char dispatchExceptionAtReset = DE_RESET; - /* * This allows the agent to exit if no * client is connected within a timeout. @@ -1089,9 +1087,6 @@ int ProcForceScreenSaver(register ClientPtr client) void CloseDownClient(register ClientPtr client) { - Bool really_close_down = client->clientGone || - client->closeDownMode == DestroyAll; - /* * There must be a better way to hook a * call-back function to be called any @@ -1114,85 +1109,7 @@ CloseDownClient(register ClientPtr client) nxagentCheckIfShadowAgent(client); - if (!client->clientGone) - { - /* ungrab server if grabbing client dies */ - if (grabState != GrabNone && grabClient == client) - { - UngrabServer(client); - } - BITCLEAR(grabWaiters, client->index); - DeleteClientFromAnySelections(client); - ReleaseActiveGrabs(client); - DeleteClientFontStuff(client); - if (!really_close_down) - { - /* This frees resources that should never be retained - * no matter what the close down mode is. Actually we - * could do this unconditionally, but it's probably - * better not to traverse all the client's resources - * twice (once here, once a few lines down in - * FreeClientResources) in the common case of - * really_close_down == TRUE. - */ - FreeClientNeverRetainResources(client); - client->clientState = ClientStateRetained; - if (ClientStateCallback) - { - NewClientInfoRec clientinfo; - - clientinfo.client = client; - clientinfo.prefix = (xConnSetupPrefix *)NULL; - clientinfo.setup = (xConnSetup *) NULL; - CallCallbacks((&ClientStateCallback), (void *)&clientinfo); - } - } - client->clientGone = TRUE; /* so events aren't sent to client */ - if (ClientIsAsleep(client)) - ClientSignal (client); - ProcessWorkQueueZombies(); - CloseDownConnection(client); - - /* If the client made it to the Running stage, nClients has - * been incremented on its behalf, so we need to decrement it - * now. If it hasn't gotten to Running, nClients has *not* - * been incremented, so *don't* decrement it. - */ - if (client->clientState != ClientStateInitial && - client->clientState != ClientStateAuthenticating ) - { - --nClients; - } - } - - if (really_close_down) - { - if (client->clientState == ClientStateRunning && nClients == 0) - dispatchException |= dispatchExceptionAtReset; - - client->clientState = ClientStateGone; - if (ClientStateCallback) - { - NewClientInfoRec clientinfo; - - clientinfo.client = client; - clientinfo.prefix = (xConnSetupPrefix *)NULL; - clientinfo.setup = (xConnSetup *) NULL; - CallCallbacks((&ClientStateCallback), (void *)&clientinfo); - } - FreeClientResources(client); - /* Disable client ID tracking. This must be done after - * ClientStateCallback. */ - ReleaseClientIds(client); - if (client->index < nextFreeClientID) - nextFreeClientID = client->index; - clients[client->index] = NullClient; - SmartLastClient = NullClient; - free(client); - - while (!clients[currentMaxClients-1]) - currentMaxClients--; - } + xorg_CloseDownClient(client); } int -- cgit v1.2.3