8225101: Crash at sun.awt.X11.XlibWrapper.XkbGetUpdatedMap when change keybord map
authorserb
Thu, 12 Sep 2019 22:20:35 -0700
changeset 58323 7b3101216e61
parent 58322 5028ccc17275
child 58324 0aba35254e00
8225101: Crash at sun.awt.X11.XlibWrapper.XkbGetUpdatedMap when change keybord map Reviewed-by: prr, pbansal
src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java
--- a/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java	Wed Sep 11 15:58:27 2019 +0530
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java	Thu Sep 12 22:20:35 2019 -0700
@@ -2558,14 +2558,16 @@
                  //System.out.println("XkbNewKeyboard:"+(xke.get_new_kbd()));
                  break;
             case XConstants.XkbMapNotify :
-                 //TODO: provide a simple unit test.
-                 XlibWrapper.XkbGetUpdatedMap(getDisplay(),
-                                              XConstants.XkbKeyTypesMask    |
-                                              XConstants.XkbKeySymsMask     |
-                                              XConstants.XkbModifierMapMask |
-                                              XConstants.XkbVirtualModsMask,
-                                              awt_XKBDescPtr);
-                 //System.out.println("XkbMap:"+(xke.get_map()));
+                 if (awt_XKBDescPtr != 0) {
+                    //TODO: provide a simple unit test.
+                    XlibWrapper.XkbGetUpdatedMap(getDisplay(),
+                                                 XConstants.XkbKeyTypesMask    |
+                                                 XConstants.XkbKeySymsMask     |
+                                                 XConstants.XkbModifierMapMask |
+                                                 XConstants.XkbVirtualModsMask,
+                                                 awt_XKBDescPtr);
+                 }
+                //System.out.println("XkbMap:"+(xke.get_map()));
                  break;
             case XConstants.XkbStateNotify :
                  // May use it later e.g. to obtain an effective group etc.