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.
This commit is contained in:
tokyo4j 2025-08-07 17:45:30 +09:00 committed by Hiroaki Yamamoto
parent 02df0a15d7
commit 418f9cb059

View file

@ -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);