Mercurial > hg > release > icedtea6-1.6
changeset 1747:6aee53732aa2 default tip
Force Event Dispatch Thread to always get created so its contextclassloader will be
set properly.
author | Man Lung Wong <mwong@redhat.com> |
---|---|
date | Fri, 30 Jul 2010 16:37:21 -0400 |
parents | f96b5fc36263 |
children | |
files | ChangeLog rt/net/sourceforge/jnlp/Launcher.java rt/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java |
diffstat | 3 files changed, 19 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- 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 <mwong@redhat.com> + * 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 <ahughes@redhat.com> * NEWS: Set date of 1.6.3 release.
--- 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.<p> * @@ -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());
--- 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); }