]> git.eshelyaron.com Git - emacs.git/commitdiff
* src/xterm.c (handle_one_xevent): Check for errors when kbd map.
authorPo Lu <luangruo@yahoo.com>
Thu, 6 Jan 2022 01:45:20 +0000 (09:45 +0800)
committerPo Lu <luangruo@yahoo.com>
Thu, 6 Jan 2022 01:45:20 +0000 (09:45 +0800)
src/xterm.c

index 8202e8fb003eaef6ad342238446d2027f3eb25e4..ad6652fb33ca2e5b3e36d763cf4120d65f618bdd 100644 (file)
@@ -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);
                }