Avoid crash when keysymToQtKey(keysym, Qt::ControlModifier) is called

For example when Ctrl+Home is sent by virtual keyboard on Wayland.

Pick-to: 6.5 6.2 5.15
Change-Id: I41f1d2a28c9091efa621d5826a3b9e3e0e481ceb
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit e68a0da0b907af7980481a3cf30f6b4b97c06b6e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexander Volkov 2023-03-06 18:10:34 +03:00 committed by Qt Cherry-pick Bot
parent ff180da7ea
commit f63cb046eb

View File

@ -731,6 +731,8 @@ xkb_keysym_t QXkbCommon::lookupLatinKeysym(xkb_state *state, xkb_keycode_t keyco
{
xkb_layout_index_t layout;
xkb_keysym_t sym = XKB_KEY_NoSymbol;
if (!state)
return sym;
xkb_keymap *keymap = xkb_state_get_keymap(state);
const xkb_layout_index_t layoutCount = xkb_keymap_num_layouts_for_key(keymap, keycode);
// Look at user layouts in the order in which they are defined in system