From 23ae68a4c74a2ec90b4130c37b0d0aec3f4082ce Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 26 Feb 2008 15:12:36 +1030 Subject: 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. --- dix/devices.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'dix') 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); -- cgit v1.2.3