From 7752677d6c68b629b05da5ce05121a3d324eddea Mon Sep 17 00:00:00 2001 From: Artem Ananiev Date: Wed, 6 Oct 2010 16:42:15 +0400 Subject: [PATCH] 6979541: closed/javax/swing/plaf/basic/AWTEventListenerLeak/AWTEventListenerLeak.java fails Reviewed-by: anthony, ant --- jdk/src/share/classes/sun/awt/SunToolkit.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jdk/src/share/classes/sun/awt/SunToolkit.java b/jdk/src/share/classes/sun/awt/SunToolkit.java index 984cb11cc69..21c0906d4aa 100644 --- a/jdk/src/share/classes/sun/awt/SunToolkit.java +++ b/jdk/src/share/classes/sun/awt/SunToolkit.java @@ -313,6 +313,11 @@ public abstract class SunToolkit extends Toolkit */ 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 @@ public abstract class SunToolkit extends Toolkit 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);