aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net
diff options
context:
space:
mode:
authorDenis Lila <[email protected]>2011-06-10 13:15:00 -0400
committerDenis Lila <[email protected]>2011-06-10 13:15:00 -0400
commit8b857cf2af30091f851656b269a622f0152905fb (patch)
treedc3ecf9177530b4e14bd8c2dd58dfc7ec44d5592 /netx/net
parent96a0c7d49de812f2da4e085d1b26857774c105e4 (diff)
Close the splashscreen in case of error (not just successful launch).
Diffstat (limited to 'netx/net')
-rw-r--r--netx/net/sourceforge/jnlp/GuiLaunchHandler.java31
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;
}