summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2008-02-26 15:12:36 +1030
committerPeter Hutterer <peter@cs.unisa.edu.au>2008-02-26 15:35:28 +1030
commit23ae68a4c74a2ec90b4130c37b0d0aec3f4082ce (patch)
tree088284e8aa85295127640c158fae9987eaea7651
parentce9fb2f8c4610016e49321018fc9b24729380afc (diff)
dix: before copying the classes the first time, set the VCK's classes to NULL.
XkbFinishDeviceInit does the following: xkbi->kbdProc= pXDev->kbdfeed->CtrlProc; pXDev->kbdfeed->CtrlProc= XkbDDXKeybdCtrlProc; If we directly copy the device classes for the VCK, pXDev->kbdfeed->CtrlProc at the time of copying is still XbkDDXKeybdCtrlProc. So at some point XkbDDXKeybdCtrlProc is called, and calls itself, and calls itself, and... Setting the device's classes to NULL seems to fix things. The memory isn't lost, it gets stored into the devPrivates and freed at device closing time.
-rw-r--r--dix/devices.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/dix/devices.c b/dix/devices.c
index 38466f889..f036985de 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -484,6 +484,21 @@ CoreKeyboardProc(DeviceIntPtr pDev, int what)
* If we don't do that, we're in SIGABRT territory (double-frees, etc)
*/
memcpy(&dummy, pDev, sizeof(DeviceIntRec));
+ /* Need to set them to NULL. Otherwise, Xkb does some weird stuff and
+ * the dev->key->xkbInfo->kbdProc starts calling itself. This can
+ * probably be fixed in a better way, but I don't know how. (whot) */
+ pDev->key = NULL;
+ pDev->valuator = NULL;
+ pDev->button = NULL;
+ pDev->focus = NULL;
+ pDev->proximity = NULL;
+ pDev->absolute = NULL;
+ pDev->kbdfeed = NULL;
+ pDev->ptrfeed = NULL;
+ pDev->intfeed = NULL;
+ pDev->stringfeed = NULL;
+ pDev->bell = NULL;
+ pDev->leds = NULL;
DeepCopyDeviceClasses(&dummy, pDev);
dixSetPrivate(&pDev->devPrivates, MasterDevClassesPrivateKey,
@@ -547,6 +562,20 @@ CorePointerProc(DeviceIntPtr pDev, int what)
/* See comment in CoreKeyboardProc. */
memcpy(&dummy, pDev, sizeof(DeviceIntRec));
+ /* Need to set them to NULL for the VCK (see CoreKeyboardProc). Not
+ * sure if also necessary for the VCP, but it doesn't seem to hurt */
+ pDev->key = NULL;
+ pDev->valuator = NULL;
+ pDev->button = NULL;
+ pDev->focus = NULL;
+ pDev->proximity = NULL;
+ pDev->absolute = NULL;
+ pDev->kbdfeed = NULL;
+ pDev->ptrfeed = NULL;
+ pDev->intfeed = NULL;
+ pDev->stringfeed = NULL;
+ pDev->bell = NULL;
+ pDev->leds = NULL;
DeepCopyDeviceClasses(&dummy, pDev);
dixSetPrivate(&pDev->devPrivates, MasterDevClassesPrivateKey, classes);