From 0425f5af643305c4b7d4e139175b37d7b0e0d173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 27 Nov 2018 16:18:28 +0100 Subject: [PATCH] xkb: Only call XkbWriteRulesProp if there's a root window The purpose of XkbWriteRulesProp is to set a property of the root window. Fixes crash in the test/tests binary during make check: Program terminated with signal SIGSEGV, Segmentation fault. #0 dixLookupProperty (result=result@entry=0x7ffed3122088, pWin=pWin@entry=0x0, propertyName=propertyName@entry=189, client=client@entry=0x7ffed3122310, access_mode=access_mode@entry=2) at ../../dix/property.c:98 98 for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) #1 0x000055e67a6456fc in dixChangeWindowProperty (pClient=0x7ffed3122310, pWin=0x0, property=property@entry=189, type=type@entry=31, format=format@entry=8, mode=mode@entry=0, len=17, value=0x55e67bf0cc50, sendevent=1) at ../../dix/property.c:269 #2 0x000055e67a7037f7 in XkbWriteRulesProp () at ../../xkb/xkbInit.c:203 #3 XkbSetRulesUsed (rmlvo=) at ../../xkb/xkbInit.c:238 #4 InitKeyboardDeviceStructInternal (dev=, rmlvo=, rmlvo@entry=0x0, keymap=keymap@entry=0x0, keymap_length=keymap_length@entry=0, bell_func=bell_func@entry=0x55e67a6184c0 , ctrl_func=ctrl_func@entry=0x55e67a6184b0 ) at ../../xkb/xkbInit.c:647 #5 0x000055e67a703c4f in InitKeyboardDeviceStruct (dev=, rmlvo=rmlvo@entry=0x0, bell_func=bell_func@entry=0x55e67a6184c0 , ctrl_func=ctrl_func@entry=0x55e67a6184b0 ) at ../../xkb/xkbInit.c:671 #6 0x000055e67a618519 in CoreKeyboardProc (what=0, pDev=) at ../../dix/devices.c:623 #7 CoreKeyboardProc (pDev=, what=) at ../../dix/devices.c:618 #8 0x000055e67a618f54 in ActivateDevice (dev=0x55e67bed69b0, sendevent=sendevent@entry=1 '\001') at ../../dix/devices.c:576 #9 0x000055e67a61dbd4 in InitCoreDevices () at ../../dix/devices.c:726 #10 0x000055e67a5abc44 in xtest_init_devices () at ../../test/xtest.c:83 #11 0x000055e67a5abe04 in xtest_test () at ../../test/xtest.c:130 #12 0x000055e67a59e4ca in run_test_in_child (func=0x55e67a5abdf0 , funcname=) at ../../test/tests-common.c:31 #13 0x000055e67a59e272 in main (argc=, argv=) at ../../test/tests.c:19 --- xkb/xkbInit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index 4108e1b26..8891cef5d 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -234,7 +234,7 @@ XkbSetRulesUsed(XkbRMLVOSet * rmlvo) XkbVariantUsed = (rmlvo->variant ? Xstrdup(rmlvo->variant) : NULL); free(XkbOptionsUsed); XkbOptionsUsed = (rmlvo->options ? Xstrdup(rmlvo->options) : NULL); - if (XkbWantRulesProp) + if (XkbWantRulesProp && screenInfo.screens[0]->root) XkbWriteRulesProp(); return; } -- GitLab