8014264: The applet pathguy_TimeDead throws java.lang.NullPointerException in java console once click drop-down check box.
authorleonidr
Thu, 20 Jun 2013 18:50:55 +0400
changeset 18520 7fad3f87d731
parent 18135 d9be76f1a19c
child 18521 80b48c6a64c9
8014264: The applet pathguy_TimeDead throws java.lang.NullPointerException in java console once click drop-down check box. Reviewed-by: art, anthony, serb
jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java
jdk/src/solaris/classes/sun/awt/X11/XChoicePeer.java
jdk/src/solaris/classes/sun/awt/X11/XListPeer.java
--- a/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java	Wed Jun 19 17:12:23 2013 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java	Thu Jun 20 18:50:55 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, 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
@@ -904,11 +904,12 @@
      */
     public void dispose() {
         setDisposed(true);
-        EventQueue.invokeLater(new Runnable() {
+        InvocationEvent ev = new InvocationEvent(target, new Runnable() {
             public void run() {
                 doDispose();
             }
         });
+        super.postEvent(ev);
     }
 
     /**
@@ -933,11 +934,12 @@
      * so events can not be processed using standart means
      */
     void postEvent(final AWTEvent event) {
-        EventQueue.invokeLater(new Runnable() {
-                public void run() {
-                    handleEvent(event);
-                }
-            });
+        InvocationEvent ev = new InvocationEvent(event.getSource(), new Runnable() {
+            public void run() {
+                handleEvent(event);
+            }
+        });
+        super.postEvent(ev);
     }
 
     /**
--- a/jdk/src/solaris/classes/sun/awt/X11/XChoicePeer.java	Wed Jun 19 17:12:23 2013 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XChoicePeer.java	Thu Jun 20 18:50:55 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -1033,15 +1033,17 @@
             //fix 6252982: PIT: Keyboard FocusTraversal not working when choice's drop-down is visible, on XToolkit
             if (e instanceof KeyEvent){
                 // notify XWindow that this event had been already handled and no need to post it again
-                EventQueue.invokeLater(new Runnable() {
-                        public void run() {
-                            if(target.isFocusable() &&
-                               getParentTopLevel().isFocusableWindow() )
-                            {
-                                handleJavaKeyEvent((KeyEvent)e);
-                            }
+                InvocationEvent ev = new InvocationEvent(target, new Runnable() {
+                    public void run() {
+                        if(target.isFocusable() &&
+                                getParentTopLevel().isFocusableWindow() )
+                        {
+                            handleJavaKeyEvent((KeyEvent)e);
                         }
-                    });
+                    }
+                });
+                postEvent(ev);
+
                 return true;
             } else {
                 if (e instanceof MouseEvent){
@@ -1083,11 +1085,13 @@
     //convenient method
     //do not generate this kind of Events
     public boolean handleMouseEventByChoice(final MouseEvent me){
-        EventQueue.invokeLater(new Runnable() {
-                public void run() {
-                    handleJavaMouseEvent(me);
-                }
-            });
+        InvocationEvent ev = new InvocationEvent(target, new Runnable() {
+            public void run() {
+                handleJavaMouseEvent(me);
+            }
+        });
+        postEvent(ev);
+
         return true;
     }
 
--- a/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java	Wed Jun 19 17:12:23 2013 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java	Thu Jun 20 18:50:55 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -1669,11 +1669,12 @@
      * Do handleJavaMouseEvent on EDT
      */
     void handleJavaMouseEventOnEDT(final MouseEvent me){
-        EventQueue.invokeLater(new Runnable() {
-                public void run() {
-                    handleJavaMouseEvent(me);
-                }
-            });
+        InvocationEvent ev = new InvocationEvent(target, new Runnable() {
+            public void run() {
+                handleJavaMouseEvent(me);
+            }
+        });
+        postEvent(ev);
     }
 
     /*