input: fix reloading crash due to keyboard group configuring

Keyboard group keyboards should not call sway_keyboard_configure. They
do not have an input config and they derive their state from the
keyboards within the group.

For some reason, I got sway_keyboard_configure and
seat_configure_keyboard mixed up and thought seat_reset_device called
the latter.

Calling sway_keyboard_configure with a keyboard group's keyboard is not
supported and can cause issues. If any clients are listening to the ipc
input event, a sigsegv will occur due to not every property - such as
identifier - being wired up for keyboard group keyboard's.

This also adds an assertion to sway_keyboard_configure to ensure that
this does not occur in the future and any instances are quickly caught.
This commit is contained in:
Brian Ashworth 2020-05-18 17:52:13 -04:00 committed by Tudor Brindus
parent 9b5895be63
commit 5c32a48453
3 changed files with 9 additions and 9 deletions

View file

@ -853,6 +853,12 @@ void sway_keyboard_configure(struct sway_keyboard *keyboard) {
struct wlr_input_device *wlr_device =
keyboard->seat_device->input_device->wlr_device;
if (!sway_assert(!wlr_keyboard_group_from_wlr_keyboard(wlr_device->keyboard),
"sway_keyboard_configure should not be called with a "
"keyboard group's keyboard")) {
return;
}
struct xkb_keymap *keymap = sway_keyboard_compile_keymap(input_config, NULL);
if (!keymap) {
sway_log(SWAY_ERROR, "Failed to compile keymap. Attempting defaults");