File N-VNC-Fix-crash-due-to-unset-input-device-names.patch of Package xorg-x11-server

From: Egbert Eich <eich@freedesktop.org>
Date: Tue, 6 Sep 2011 14:58:28 +0200
Subject: [PATCH 6/6] VNC: Fix crash due to unset input device names.
Patch-Mainline: Currently no upstream project.
Git-commit: b756a7efff37021ca503fe1e63084daae4082e9d
Signed-off: Egbert Eich <eich@suse.de> 
References: bnc #716074

 Signed-off-by: Egbert Eich <eich@freedesktop.org>

---
 hw/vnc/init.c     |    2 +-
 hw/vnc/rfb.h      |    2 +-
 hw/vnc/rfbkeyb.c  |    7 +++++--
 hw/vnc/rfbmouse.c |    9 +++++++--
 4 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/hw/vnc/init.c b/hw/vnc/init.c
index 0977fee..6f83aa8 100644
--- a/hw/vnc/init.c
+++ b/hw/vnc/init.c
@@ -816,7 +816,7 @@ rfbMouseProc(DeviceIntPtr pDevice, int onoff)
     switch (onoff)
     {
     case DEVICE_INIT:
-	PtrDeviceInit();
+	PtrDeviceInit(pDevice, "vncMouse");
 	map[1] = 1;
 	map[2] = 2;
 	map[3] = 3;
diff --git a/hw/vnc/rfb.h b/hw/vnc/rfb.h
index 70b1a45..aa9abab 100644
--- a/hw/vnc/rfb.h
+++ b/hw/vnc/rfb.h
@@ -578,7 +578,7 @@ extern void rfbGotXCutText(char *str, int len);
 extern Bool compatibleKbd;
 extern unsigned char ptrAcceleration;
 
-extern void PtrDeviceInit(void);
+extern void PtrDeviceInit(DeviceIntPtr pDevice, char *name);
 extern void PtrDeviceOn(DeviceIntPtr pDev);
 extern void PtrDeviceOff(void);
 extern void PtrDeviceControl(DeviceIntPtr dev, PtrCtrl *ctrl);
diff --git a/hw/vnc/rfbkeyb.c b/hw/vnc/rfbkeyb.c
index 4da29c2..6d97999 100644
--- a/hw/vnc/rfbkeyb.c
+++ b/hw/vnc/rfbkeyb.c
@@ -36,6 +36,7 @@
 #endif
 #include <xf86Xinput.h>
 #include <exevents.h>		/* Needed for InitValuator/Proximity stuff */
+#include <extinit.h>
 #include <mipointer.h>
 
 #ifdef XFree86LOADER
@@ -49,7 +50,6 @@
 
 
 extern void rfbSendBell(void);
-extern DeviceIntPtr kbdDevice;
 extern void vncInitKeyb(void);
 
 #include <X11/keysym.h>
@@ -212,11 +212,15 @@ static KeySym map[MAX_KEY_CODE * GLYPHS_PER_KEY] = {
 };
 
 #define N_PREDEFINED_KEYS (sizeof(map) / (sizeof(KeySym) * GLYPHS_PER_KEY))
+#define RFB_KEYB "rfbKeyb"
 
 void
 KbdDeviceInit(DeviceIntPtr pDevice, KeySymsPtr pKeySyms, CARD8 *pModMap)
 {
     int i;
+    Atom atom = MakeAtom(RFB_KEYB, strlen(RFB_KEYB), TRUE);
+
+    AssignTypeAndName(pDevice, atom, RFB_KEYB);
 
     for (i = 0; i < MAP_LENGTH; i++)
 	pModMap[i] = NoSymbol;
@@ -359,7 +363,6 @@ xf86rfbKeybInit(struct _InputDriverRec *drv,
     pInfo->control_proc = NULL;
     pInfo->switch_mode = NULL;
     pInfo->fd = -1;
-    pInfo->dev = NULL;
 
     /* Collect the options, and process the common options. */
     xf86CollectInputOptions(pInfo, (const char**)drv->default_options);
diff --git a/hw/vnc/rfbmouse.c b/hw/vnc/rfbmouse.c
index 4657128..86e8f2f 100644
--- a/hw/vnc/rfbmouse.c
+++ b/hw/vnc/rfbmouse.c
@@ -37,6 +37,7 @@
 #endif
 #include <xf86Xinput.h>
 #include <exevents.h>		/* Needed for InitValuator/Proximity stuff */
+#include <extinit.h>
 #include <mipointer.h>
 
 #ifdef XFree86LOADER
@@ -63,8 +64,12 @@ PtrDeviceOn(DeviceIntPtr pDev)
 }
 
 void
-PtrDeviceInit(void)
+PtrDeviceInit(DeviceIntPtr pDevice, char *name)
 {
+      Atom atom = MakeAtom(name, strlen(name), TRUE);
+
+      AssignTypeAndName(pDevice, atom, name);
+
 }
 
 void
@@ -119,7 +124,7 @@ xf86rfbMouseControlProc(DeviceIntPtr dev, int onoff)
     {
     case DEVICE_INIT:
         vncSetPointerDevice(dev);
-	PtrDeviceInit();
+	//	PtrDeviceInit(dev, "rfbPointer");
 	map[1] = 1;
 	map[2] = 2;
 	map[3] = 3;
-- 
1.7.3.4

openSUSE Build Service is sponsored by