6979541: closed/javax/swing/plaf/basic/AWTEventListenerLeak/AWTEventListenerLeak.java fails
authorart
Wed, 06 Oct 2010 16:42:15 +0400
changeset 6821 f5949f5159ec
parent 6820 bd6e9b4e1460
child 6822 0a6eba317c96
6979541: closed/javax/swing/plaf/basic/AWTEventListenerLeak/AWTEventListenerLeak.java fails Reviewed-by: anthony, ant
jdk/src/share/classes/sun/awt/SunToolkit.java
--- a/jdk/src/share/classes/sun/awt/SunToolkit.java	Tue Oct 05 18:13:52 2010 +0400
+++ b/jdk/src/share/classes/sun/awt/SunToolkit.java	Wed Oct 06 16:42:15 2010 +0400
@@ -313,6 +313,11 @@
      */
     public static AppContext createNewAppContext() {
         ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
+        // Create appContext before initialization of EventQueue, so all
+        // the calls to AppContext.getAppContext() from EventQueue ctor
+        // return correct values
+        AppContext appContext = new AppContext(threadGroup);
+
         EventQueue eventQueue;
         String eqName = System.getProperty("AWT.EventQueueClass",
                                            "java.awt.EventQueue");
@@ -322,7 +327,6 @@
             System.err.println("Failed loading " + eqName + ": " + e);
             eventQueue = new EventQueue();
         }
-        AppContext appContext = new AppContext(threadGroup);
         appContext.put(AppContext.EVENT_QUEUE_KEY, eventQueue);
 
         PostEventQueue postEventQueue = new PostEventQueue(eventQueue);