From 29d81c0d4a4af8a613efa1d32c3250fb0898f4fe Mon Sep 17 00:00:00 2001 From: Takuro Ashie Date: Mon, 16 Aug 2021 14:51:45 +0900 Subject: [PATCH] Fix crash on activating a text area without a real keyboard It will cause on following situation: * Enable weston-simple-im * It's also reproducible with IBus or Fcitx5 * Connect a mouse or a touch panel * Don't connect keyboad * Launch weston-editor and touch the text area It doesn't reproduce with weston-keyboard because it doesn't use grab_keyboard of input-method-context-v1. Signed-off-by: Takuro Ashie --- compositor/text-backend.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compositor/text-backend.c b/compositor/text-backend.c index 1a5c7fd2..5cd994cb 100644 --- a/compositor/text-backend.c +++ b/compositor/text-backend.c @@ -676,6 +676,9 @@ input_method_context_grab_keyboard(struct wl_client *client, struct weston_seat *seat = context->input_method->seat; struct weston_keyboard *keyboard = weston_seat_get_keyboard(seat); + if (!keyboard) + return; + cr = wl_resource_create(client, &wl_keyboard_interface, 1, id); wl_resource_set_implementation(cr, NULL, context, unbind_keyboard);