From 7cdef0d6fc3ec6705a61014b741a4c24dc60973b Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Sun, 1 Jun 2008 15:20:42 +0930 Subject: [PATCH] xkb: delete default rules when devices are closed. We only have one set of default rules options in xkb. When the second keyboard is brought up with Xkb options specified, these new options overwrite the old. In future server generations, the rules used for the VCK are a mixture of the default ones and ones previously specified for other keyboards. Simply resetting the xkb default rules to NULL avoids this issue. Reproducable by setting XkbLayout "de" and XkbVariant "nodeadkeys". In the second server generation, the VCK has "us(nodeadkeys)". This again produces a SIGABRT when the first key is hit. I could not figure out why the SIGABRT happens. This patch is avoiding the issue rather than fixing it. (cherry picked from commit 5a3d06b8f42473cea3741dc722a775deaa2b73f6) --- dix/devices.c | 3 +++ include/xkbsrv.h | 4 ++++ xkb/xkbInit.c | 15 +++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/dix/devices.c b/dix/devices.c index f6f3c8ece..c02b7ae55 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -634,6 +634,9 @@ CloseDownDevices(void) inputInfo.off_devices = NULL; inputInfo.keyboard = NULL; inputInfo.pointer = NULL; +#ifdef XKB + XkbDeleteRulesDflts(); +#endif } /** diff --git a/include/xkbsrv.h b/include/xkbsrv.h index acf3bb0a3..b52eb6520 100644 --- a/include/xkbsrv.h +++ b/include/xkbsrv.h @@ -895,6 +895,10 @@ extern void XkbSetRulesDflts( char * /* options */ ); +extern void XkbDeleteRulesDflts( + void +); + extern void XkbInitDevice( DeviceIntPtr /* pXDev */ ); diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index c0867adf0..87ee0720e 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -278,6 +278,21 @@ XkbSetRulesDflts(char *rulesFile,char *model,char *layout, return; } +void +XkbDeleteRulesDflts() +{ + _XkbFree(XkbRulesFile); + XkbRulesFile = NULL; + _XkbFree(XkbModelDflt); + XkbModelDflt = NULL; + _XkbFree(XkbLayoutDflt); + XkbLayoutDflt = NULL; + _XkbFree(XkbVariantDflt); + XkbVariantDflt = NULL; + _XkbFree(XkbOptionsDflt); + XkbOptionsDflt = NULL; +} + /***====================================================================***/ #if defined(luna)