[PATCH 0/1] MR7359: winewayland: Don't crash on text input done events without focus.
Some compositors (e.g., kwin) will send a done event for every commit, regardless of the focus state of the text input. This behavior is arguably(?) out of spec, but otherwise harmless, so just ignore the new state in such cases. -- To reproduce (without the fix) simple open notepad under kwin and change the focus do a different window. The root cause of this is that kwin is responding to the disable&commit we perform on text_input leave. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/7359
From: Alexandros Frantzis <alexandros.frantzis(a)collabora.com> Some compositors (e.g., kwin) will send a done event for every commit, regardless of the focus state of the text input. This behavior is arguably out of spec, but otherwise harmless, so just ignore the new state in such cases. --- dlls/winewayland.drv/wayland_text_input.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/dlls/winewayland.drv/wayland_text_input.c b/dlls/winewayland.drv/wayland_text_input.c index 17257634b2e..e0181eb8240 100644 --- a/dlls/winewayland.drv/wayland_text_input.c +++ b/dlls/winewayland.drv/wayland_text_input.c @@ -131,11 +131,15 @@ static void text_input_done(void *data, struct zwp_text_input_v3 *zwp_text_input TRACE("data %p, text_input %p, serial %u.\n", data, zwp_text_input_v3, serial); pthread_mutex_lock(&text_input->mutex); - assert(text_input->wl_surface); - hwnd = wl_surface_get_user_data(text_input->wl_surface); - - post_ime_update(hwnd, text_input->preedit_cursor_pos, text_input->preedit_string, - text_input->commit_string); + /* Some compositors will send a done event for every commit, regardless of + * the focus state of the text input. This behavior is arguably out of spec, + * but otherwise harmless, so just ignore the new state in such cases. */ + if (text_input->wl_surface) + { + hwnd = wl_surface_get_user_data(text_input->wl_surface); + post_ime_update(hwnd, text_input->preedit_cursor_pos, text_input->preedit_string, + text_input->commit_string); + } free(text_input->preedit_string); text_input->preedit_string = NULL; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/7359
@atticf (can't add you as reviewer...) -- https://gitlab.winehq.org/wine/wine/-/merge_requests/7359#note_95020
participants (2)
-
Alexandros Frantzis -
Alexandros Frantzis (@afrantzis)