8013849: Awt assert on Hashtable.cpp:124
authoralexsch
Wed, 07 Aug 2013 18:58:28 +0400
changeset 19178 81fa1a77bf7b
parent 19177 73eb8134c0d2
child 19179 b59142223aac
8013849: Awt assert on Hashtable.cpp:124 Reviewed-by: serb
jdk/src/windows/native/sun/windows/awt_Component.cpp
jdk/test/java/awt/event/KeyEvent/DeadKey/DeadKeySystemAssertionDialog.java
--- a/jdk/src/windows/native/sun/windows/awt_Component.cpp	Wed Aug 07 18:32:03 2013 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_Component.cpp	Wed Aug 07 18:58:28 2013 +0400
@@ -3528,8 +3528,12 @@
     if (ops == SAVE) {
         transTable.put(reinterpret_cast<void*>(static_cast<INT_PTR>(wkey)),
                        reinterpret_cast<void*>(static_cast<INT_PTR>(translation)));
-        deadKeyFlagTable.put(reinterpret_cast<void*>(static_cast<INT_PTR>(wkey)),
-                       reinterpret_cast<void*>(static_cast<INT_PTR>(deadKeyFlag)));
+        if (deadKeyFlag) {
+            deadKeyFlagTable.put(reinterpret_cast<void*>(static_cast<INT_PTR>(wkey)),
+                         reinterpret_cast<void*>(static_cast<INT_PTR>(deadKeyFlag)));
+        } else {
+            deadKeyFlagTable.remove(reinterpret_cast<void*>(static_cast<INT_PTR>(wkey)));
+        }
     }
 
     isDeadKey = deadKeyFlag;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/KeyEvent/DeadKey/DeadKeySystemAssertionDialog.java	Wed Aug 07 18:58:28 2013 +0400
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Frame;
+import java.awt.Robot;
+import java.awt.TextField;
+import java.awt.Toolkit;
+import java.awt.event.KeyEvent;
+import sun.awt.SunToolkit;
+/*
+ * @test
+ * @bug 8013849
+ * @summary Awt assert on Hashtable.cpp:124
+ * @author alexandr.scherbatiy area=awt.event
+ * @run main/timeout=5 DeadKeySystemAssertionDialog
+ */
+
+public class DeadKeySystemAssertionDialog {
+
+    public static void main(String[] args) throws Exception {
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Frame frame = new Frame();
+        frame.setSize(300, 200);
+
+        TextField textField = new TextField();
+        frame.add(textField);
+
+        frame.setVisible(true);
+        toolkit.realSync();
+
+        textField.requestFocus();
+        toolkit.realSync();
+
+        // Check that the system assertion dialog does not block Java
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+        robot.keyPress(KeyEvent.VK_A);
+        robot.keyRelease(KeyEvent.VK_A);
+        toolkit.realSync();
+
+        frame.setVisible(false);
+        frame.dispose();
+    }
+}