From 5749c57e473808b589a615ac4e4e7f7eef8da949 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Thu, 6 Jan 2022 09:45:20 +0800 Subject: [PATCH] * src/xterm.c (handle_one_xevent): Check for errors when kbd map. --- src/xterm.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index 8202e8fb003..ad6652fb33c 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -11253,15 +11253,22 @@ handle_one_xevent (struct x_display_info *dpyinfo, { if (dpyinfo->xkb_desc) { - XkbGetUpdatedMap (dpyinfo->display, - (XkbKeySymsMask - | XkbKeyTypesMask - | XkbModifierMapMask - | XkbVirtualModsMask), - dpyinfo->xkb_desc); - XkbGetNames (dpyinfo->display, - XkbGroupNamesMask | XkbVirtualModNamesMask, - dpyinfo->xkb_desc); + if (XkbGetUpdatedMap (dpyinfo->display, + (XkbKeySymsMask + | XkbKeyTypesMask + | XkbModifierMapMask + | XkbVirtualModsMask), + dpyinfo->xkb_desc) == Success) + { + XkbGetNames (dpyinfo->display, + XkbGroupNamesMask | XkbVirtualModNamesMask, + dpyinfo->xkb_desc); + } + else + { + XkbFreeKeyboard (dpyinfo->xkb_desc, XkbAllComponentsMask, True); + dpyinfo->xkb_desc = NULL; + } x_find_modifier_meanings (dpyinfo); } -- 2.39.2