From 9ea88717db376b54b2c821ab67e846918acc616a Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Sun, 3 Jul 2016 22:06:43 +0200 Subject: 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. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=27497 Signed-off-by: Jamey Sharp Cc: Chris Wilson Reviewed-by: Julien Cristau Reviewed-by: Adam Jackson Backport to nx-libs: Mike Gabriel --- nx-X11/programs/Xserver/dix/events.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'nx-X11/programs/Xserver/dix') diff --git a/nx-X11/programs/Xserver/dix/events.c b/nx-X11/programs/Xserver/dix/events.c index 676640f01..4d1472cc8 100644 --- a/nx-X11/programs/Xserver/dix/events.c +++ b/nx-X11/programs/Xserver/dix/events.c @@ -4439,6 +4439,9 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) xEvent eventTo, *eventFrom; int i; + if (!pClient || pClient == serverClient || pClient->clientGone) + return; + #ifdef XKB if ((!noXkbExtension)&&(!XkbFilterEvents(pClient, count, events))) return; -- cgit v1.2.3