[X2Go-Commits] [nx-libs] 79/219: CloseDevice: call XkbRemoveResourceClient before freeing key class struct

git-admin at x2go.org git-admin at x2go.org
Sat Sep 28 12:10:25 CEST 2019


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch 3.6.x
in repository nx-libs.

commit ca741177e8a36f0eb5e84a047681bfd2edd3e3ba
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Mon Jun 17 18:15:05 2019 +0200

    CloseDevice: call XkbRemoveResourceClient before freeing key class struct
    
    This patch is not necessary at the current code level. But when xkb
    code introduced the dev->key check Xorg upstream missed that. So we
    backport it now to skip that trap when updating xkb code.
    
      Author: Alan Coopersmith <alan.coopersmith at sun.com>
      Date:   Mon Jan 4 18:21:54 2010 -0800
    
        CloseDevice: call XkbRemoveResourceClient before freeing key class struct
    
        XkbRemoveResourceClient() returns immediately if dev->key is NULL.
        CloseDevice calls XkbRemoveResourceClient until it removes all resources.
    
        If we free dev->key and NULL it before XkbRemoveResourceClient, then
        infinite loop ensues, and the server appears to hang on exit or crash.
    
        Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>
        Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
        Reviewed-by: Daniel Stone <daniel at fooishbar.org>
        Signed-off-by: Keith Packard <keithp at keithp.com>
    
    Backported-to-NX-by: Ulrich Sibiller <uli42 at gmx.de>
---
 nx-X11/programs/Xserver/dix/devices.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/nx-X11/programs/Xserver/dix/devices.c b/nx-X11/programs/Xserver/dix/devices.c
index 51cf3fef9..8ad1cc371 100644
--- a/nx-X11/programs/Xserver/dix/devices.c
+++ b/nx-X11/programs/Xserver/dix/devices.c
@@ -203,7 +203,15 @@ CloseDevice(register DeviceIntPtr dev)
 
     if (dev->inited)
 	(void)(*dev->deviceProc)(dev, DEVICE_CLOSE);
+
+#ifdef XKB
+    while (dev->xkb_interest) {
+	XkbRemoveResourceClient((DevicePtr)dev,dev->xkb_interest->resource);
+    }
+#endif
+
     free(dev->name);
+
     if (dev->key)
     {
 #ifdef XKB
@@ -267,11 +275,6 @@ CloseDevice(register DeviceIntPtr dev)
 #endif
 	free(l);
     }
-#ifdef XKB
-    while (dev->xkb_interest) {
-	XkbRemoveResourceClient((DevicePtr)dev,dev->xkb_interest->resource);
-    }
-#endif
     free(dev->sync.event);
     free(dev);
 }

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git


More information about the x2go-commits mailing list