8225101: Crash at sun.awt.X11.XlibWrapper.XkbGetUpdatedMap when change keybord map
Reviewed-by: prr, pbansal
--- 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.