From: tokyo4j Date: Thu, 7 Aug 2025 08:45:30 +0000 (+0900) Subject: ime: fix segfault when IME is killed X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=418f9cb05907be6209a36ed74d5749ce853b2e35;p=proto%2Flabwc.git ime: fix segfault when IME is killed Fixes up e530f43. When IME (e.g. fcitx5) is killed, relay->input_method is destroyed and then relay->input_method->keyboard_grab is destroyed, which causes null pointer dereference and crashes labwc. Possible solutions are: - Let wlroots keep emitting keyboard grab as `data` from keyboard grab's destroy handler just like before - Let wlroots destroy keyboard grab before input method - Let compositor store keyboard grab as relay->keyboard_grab But let's just revert the change in e530f43 for now. --- diff --git a/src/input/ime.c b/src/input/ime.c index cf8cd2d9..f6e0ac99 100644 --- a/src/input/ime.c +++ b/src/input/ime.c @@ -304,8 +304,8 @@ handle_keyboard_grab_destroy(struct wl_listener *listener, void *data) { struct input_method_relay *relay = wl_container_of(listener, relay, keyboard_grab_destroy); - struct wlr_input_method_keyboard_grab_v2 *keyboard_grab = - relay->input_method->keyboard_grab; + struct wlr_input_method_keyboard_grab_v2 *keyboard_grab = data; + assert(keyboard_grab); wl_list_remove(&relay->keyboard_grab_destroy.link);