8023994: Right click on the icon added to the system tray for the first time, java.lang.IllegalArgumentException thrown.
authorleonidr
Wed, 02 Oct 2013 17:06:09 +0400
changeset 20449 20326f6cd2aa
parent 20448 0eef03207781
child 20450 008da09ac2b2
8023994: Right click on the icon added to the system tray for the first time, java.lang.IllegalArgumentException thrown. Reviewed-by: anthony, serb
jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java
--- a/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java	Wed Oct 02 16:58:13 2013 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java	Wed Oct 02 17:06:09 2013 +0400
@@ -116,6 +116,8 @@
     protected Point grabInputPoint = null;
     protected boolean hasPointerMoved = false;
 
+    private AppContext disposeAppContext;
+
     /************************************************
      *
      * Mapping data
@@ -174,6 +176,8 @@
     XBaseMenuWindow() {
         super(new XCreateWindowParams(new Object[] {
             DELAYED, Boolean.TRUE}));
+
+        disposeAppContext = AppContext.getAppContext();
     }
 
     /************************************************
@@ -904,12 +908,12 @@
      */
     public void dispose() {
         setDisposed(true);
-        InvocationEvent ev = new InvocationEvent(target, new Runnable() {
+
+        SunToolkit.invokeLaterOnAppContext(disposeAppContext, new Runnable()  {
             public void run() {
                 doDispose();
             }
         });
-        super.postEvent(ev);
     }
 
     /**
@@ -923,7 +927,6 @@
         if (oldData != null) {
             oldData.invalidate();
         }
-        XToolkit.targetDisposedPeer(target, this);
         destroy();
     }