From 32e4a88ae613c7200d84d5621344b418b656346b Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 8 Apr 2008 08:42:58 +0930 Subject: [PATCH] xkb: don't overwrite CtrlProc in the second run of XkbFinishDeviceInit. XkbFinishDeviceInit is called once when the device is initialised, but also when a class copy causes the key class of a device to change. In this case, overwriting the CtrlProc of the KeybdFeedbackClass with XkbDDXKeybdCtrlProc sets up a nice recursive loop of XkbDDXKeybdCtrlProc calling itself until the cows come home. --- xkb/xkbInit.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index ce5de077e..0d5d15ef3 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -726,7 +726,10 @@ XkbSrvLedInfoPtr sli; if (pXDev && pXDev->key && pXDev->key->xkbInfo && pXDev->kbdfeed) { xkbi= pXDev->key->xkbInfo; xkb= xkbi->desc; - if (pXDev->kbdfeed) { + /* If we come from DeepCopyDeviceClasses, the CtrlProc was already set + * to XkbDDXKeybdCtrlProc, overwriting it leads to happy recursion. + */ + if (pXDev->kbdfeed && pXDev->kbdfeed->CtrlProc != XkbDDXKeybdCtrlProc) { xkbi->kbdProc= pXDev->kbdfeed->CtrlProc; pXDev->kbdfeed->CtrlProc= XkbDDXKeybdCtrlProc; }