diff options
Diffstat (limited to 'netx/net')
-rw-r--r-- | netx/net/sourceforge/jnlp/GuiLaunchHandler.java | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/netx/net/sourceforge/jnlp/GuiLaunchHandler.java b/netx/net/sourceforge/jnlp/GuiLaunchHandler.java index 28a2013..90fe15c 100644 --- a/netx/net/sourceforge/jnlp/GuiLaunchHandler.java +++ b/netx/net/sourceforge/jnlp/GuiLaunchHandler.java @@ -53,6 +53,7 @@ import net.sourceforge.jnlp.util.BasicExceptionDialog; public class GuiLaunchHandler implements LaunchHandler { private JNLPSplashScreen splashScreen = null; + private final Object mutex = new Object(); private UpdatePolicy policy = UpdatePolicy.ALWAYS; @Override @@ -65,22 +66,29 @@ public class GuiLaunchHandler implements LaunchHandler { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { + closeSplashScreen(); BasicExceptionDialog.show(exception); } }); } + private void closeSplashScreen() { + synchronized(mutex) { + if (splashScreen != null) { + if (splashScreen.isSplashScreenValid()) { + splashScreen.setVisible(false); + } + splashScreen.dispose(); + } + } + } + @Override public void launchStarting(ApplicationInstance application) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - if (splashScreen != null) { - if (splashScreen.isSplashScreenValid()) { - splashScreen.setVisible(false); - } - splashScreen.dispose(); - } + closeSplashScreen(); } }); } @@ -98,10 +106,12 @@ public class GuiLaunchHandler implements LaunchHandler { if (splashImageURL != null) { ResourceTracker resourceTracker = new ResourceTracker(true); resourceTracker.addResource(splashImageURL, file.getFileVersion(), null, policy); - splashScreen = new JNLPSplashScreen(resourceTracker, null, null); - splashScreen.setSplashImageURL(splashImageURL); - if (splashScreen.isSplashScreenValid()) { - splashScreen.setVisible(true); + synchronized(mutex) { + splashScreen = new JNLPSplashScreen(resourceTracker, null, null); + splashScreen.setSplashImageURL(splashImageURL); + if (splashScreen.isSplashScreenValid()) { + splashScreen.setVisible(true); + } } } } @@ -116,6 +126,7 @@ public class GuiLaunchHandler implements LaunchHandler { @Override public boolean validationError(LaunchException security) { + closeSplashScreen(); DefaultLaunchHandler.printMessage(security); return true; } |