Skip to content

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=<optimized out>) at ../../xkb/xkbInit.c:238
#4  InitKeyboardDeviceStructInternal (dev=<optimized out>, rmlvo=<optimized out>, rmlvo@entry=0x0, keymap=keymap@entry=0x0, keymap_length=keymap_length@entry=0, bell_func=bell_func@entry=0x55e67a6184c0 <CoreKeyboardBell>, 
    ctrl_func=ctrl_func@entry=0x55e67a6184b0 <CoreKeyboardCtl>) at ../../xkb/xkbInit.c:647
#5  0x000055e67a703c4f in InitKeyboardDeviceStruct (dev=<optimized out>, rmlvo=rmlvo@entry=0x0, bell_func=bell_func@entry=0x55e67a6184c0 <CoreKeyboardBell>, ctrl_func=ctrl_func@entry=0x55e67a6184b0 <CoreKeyboardCtl>) at ../../xkb/xkbInit.c:671
#6  0x000055e67a618519 in CoreKeyboardProc (what=0, pDev=<optimized out>) at ../../dix/devices.c:623
#7  CoreKeyboardProc (pDev=<optimized out>, what=<optimized out>) 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 <xtest_test>, funcname=<optimized out>) at ../../test/tests-common.c:31
#13 0x000055e67a59e272 in main (argc=<optimized out>, argv=<optimized out>) at ../../test/tests.c:19

Merge request reports