From: chenzhengyong <chenzhengyong@uniontech.com> xkb_state may be NULL if the keyboard has not been fully initialized when a modifiers event arrives. Add a NULL check before calling xkb_state_update_mask to prevent a crash. Signed-off-by: chenzhengyong <chenzhengyong@uniontech.com> --- dlls/winewayland.drv/wayland_keyboard.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/winewayland.drv/wayland_keyboard.c b/dlls/winewayland.drv/wayland_keyboard.c index 0a6eea2fa73..279c45612e7 100644 --- a/dlls/winewayland.drv/wayland_keyboard.c +++ b/dlls/winewayland.drv/wayland_keyboard.c @@ -900,8 +900,11 @@ static void keyboard_handle_modifiers(void *data, struct wl_keyboard *wl_keyboar serial, mods_depressed, mods_latched, mods_locked, xkb_group); pthread_mutex_lock(&keyboard->mutex); - xkb_state_update_mask(keyboard->xkb_state, mods_depressed, mods_latched, - mods_locked, 0, 0, xkb_group); + if (keyboard->xkb_state) + { + xkb_state_update_mask(keyboard->xkb_state, mods_depressed, mods_latched, + mods_locked, 0, 0, xkb_group); + } pthread_mutex_unlock(&keyboard->mutex); set_current_xkb_group(xkb_group); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11151