# HG changeset patch # User Man Lung Wong # Date 1280522241 14400 # Node ID 6aee53732aa23f6894ab69bd38e6d24242478527 # Parent f96b5fc36263ccb44593f9e77645499de67267f9 Force Event Dispatch Thread to always get created so its contextclassloader will be set properly. diff -r f96b5fc36263 -r 6aee53732aa2 ChangeLog --- a/ChangeLog Mon Jul 26 23:38:19 2010 +0100 +++ b/ChangeLog Fri Jul 30 16:37:21 2010 -0400 @@ -1,3 +1,15 @@ +2010-07-30 Man Lung Wong + * netx/net/sourceforge/jnlp/Launcher.java + (launchApplication): Make sure an Event Dispatch Thread + is created before contextclassloader gets set. + * netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java + (ContextUpdater): Removed it as it is no longer useful after + the above change. + (checkTopLevelWindow): Removed the line that adds + ContextUpdater as it no longer exists. + * NEWS: This fixes one of the problems launching the link + mentioned in icedtea bug 486. + 2010-07-26 Andrew John Hughes * NEWS: Set date of 1.6.3 release. diff -r f96b5fc36263 -r 6aee53732aa2 rt/net/sourceforge/jnlp/Launcher.java --- a/rt/net/sourceforge/jnlp/Launcher.java Mon Jul 26 23:38:19 2010 +0100 +++ b/rt/net/sourceforge/jnlp/Launcher.java Fri Jul 30 16:37:21 2010 -0400 @@ -43,6 +43,8 @@ import net.sourceforge.jnlp.services.ServiceUtil; import net.sourceforge.jnlp.util.Reflect; +import javax.swing.SwingUtilities; + /** * Launches JNLPFiles either in the foreground or background.

* @@ -426,6 +428,11 @@ Method main = mainClass.getDeclaredMethod("main", new Class[] {String[].class} ); String args[] = file.getApplication().getArguments(); + + SwingUtilities.invokeAndWait(new Runnable() { + // dummy method to force Event Dispatch Thread creation + public void run(){} + }); setContextClassLoaderForAllThreads(app.getClassLoader()); diff -r f96b5fc36263 -r 6aee53732aa2 rt/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java --- a/rt/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java Mon Jul 26 23:38:19 2010 +0100 +++ b/rt/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java Fri Jul 30 16:37:21 2010 -0400 @@ -101,43 +101,9 @@ /** weak reference to most app who's windows was most recently activated */ private WeakReference activeApplication = null; - /** listener installs the app's classloader on the event dispatch thread */ - private ContextUpdater contextListener = new ContextUpdater(); - /** Sets whether or not exit is allowed (in the context of the plugin, this is always false) */ private boolean exitAllowed = true; - private class ContextUpdater extends WindowAdapter implements PrivilegedAction { - private ApplicationInstance app = null; - - public void windowActivated(WindowEvent e) { - app = getApplication(e.getWindow()); - AccessController.doPrivileged(this); - app = null; - } - - public Object run() { - if (app != null) { - Thread.currentThread().setContextClassLoader(app.getClassLoader()); - activeApplication = new WeakReference(app); - } - else - Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); - - return null; - } - - public void windowDeactivated(WindowEvent e) { - activeApplication = null; - } - - public void windowClosing(WindowEvent e) { - System.err.println("Disposing window"); - e.getWindow().dispose(); - } - }; - - /** * Creates a JNLP SecurityManager. */ @@ -410,8 +376,6 @@ weakWindows.add(window); // for mapping window -> app weakApplications.add(app); - w.addWindowListener(contextListener); // for dynamic context classloader - app.addWindow(w); }