diff --git a/src/main/java/com/threerings/getdown/data/Application.java b/src/main/java/com/threerings/getdown/data/Application.java index b86e2ac..e800561 100644 --- a/src/main/java/com/threerings/getdown/data/Application.java +++ b/src/main/java/com/threerings/getdown/data/Application.java @@ -1241,9 +1241,8 @@ public class Application * validated" resources filled in. * @param unpacked a set to populate with unpacked resources. */ - public List verifyResources ( - ProgressObserver obs, int[] alreadyValid, Set unpacked) - throws InterruptedException + public List verifyResources (ProgressObserver obs, int[] alreadyValid, + Set unpacked) throws InterruptedException { List rsrcs = getAllActiveResources(); List failures = new ArrayList(); diff --git a/src/main/java/com/threerings/getdown/launcher/Getdown.java b/src/main/java/com/threerings/getdown/launcher/Getdown.java index 4cfa14e..80b9667 100644 --- a/src/main/java/com/threerings/getdown/launcher/Getdown.java +++ b/src/main/java/com/threerings/getdown/launcher/Getdown.java @@ -133,10 +133,10 @@ public abstract class Getdown extends Thread { try { _ifc = _app.init(true); - createInterface(true); + createInterfaceAsync(true); } catch (Exception e) { log.warning("Failed to preinit: " + e); - createInterface(true); + createInterfaceAsync(true); } } @@ -373,7 +373,7 @@ public abstract class Getdown extends Thread // and re-initalize _ifc = _app.init(true); // now force our UI to be recreated with the updated info - createInterface(true); + createInterfaceAsync(true); } if (!_app.lockForUpdates()) { throw new MultipleGetdownRunning(); @@ -429,7 +429,7 @@ public abstract class Getdown extends Thread // make sure we have the desired version and that the metadata files are valid... setStep(Step.VERIFY_METADATA); - setStatus("m.validating", -1, -1L, false); + setStatusAsync("m.validating", -1, -1L, false); if (_app.verifyMetadata(this)) { log.info("Application requires update."); update(); @@ -439,7 +439,7 @@ public abstract class Getdown extends Thread // now verify our resources... setStep(Step.VERIFY_RESOURCES); - setStatus("m.validating", -1, -1L, false); + setStatusAsync("m.validating", -1, -1L, false); List failures = _app.verifyResources(_progobs, alreadyValid, unpacked); if (failures == null) { log.info("Resources verified."); @@ -533,7 +533,7 @@ public abstract class Getdown extends Thread // documentation inherited from interface public void updateStatus (String message) { - setStatus(message, -1, -1L, true); + setStatusAsync(message, -1, -1L, true); } /** @@ -649,7 +649,7 @@ public abstract class Getdown extends Thread // show the patch notes button, if applicable if (!StringUtil.isBlank(_ifc.patchNotesUrl)) { - createInterface(false); + createInterfaceAsync(false); EventQueue.invokeLater(new Runnable() { public void run () { _patchNotes.setVisible(true); @@ -701,7 +701,7 @@ public abstract class Getdown extends Thread throws IOException, InterruptedException { // create our user interface - createInterface(false); + createInterfaceAsync(false); // create a downloader to download our resources Downloader.Observer obs = new Downloader.Observer() { @@ -726,7 +726,7 @@ public abstract class Getdown extends Thread // to check if this was the reason for aborting. return false; } - setStatus("m.downloading", stepToGlobalPercent(percent), remaining, true); + setStatusAsync("m.downloading", stepToGlobalPercent(percent), remaining, true); if (percent > 0) { reportTrackingEvent("progress", percent); } @@ -759,7 +759,7 @@ public abstract class Getdown extends Thread protected void launch () { setStep(Step.LAUNCH); - setStatus("m.launching", stepToGlobalPercent(100), -1L, false); + setStatusAsync("m.launching", stepToGlobalPercent(100), -1L, false); try { if (invokeDirect()) { @@ -834,8 +834,9 @@ public abstract class Getdown extends Thread } // pump the percent up to 100% - setStatus(null, 100, -1L, false); + setStatusAsync(null, 100, -1L, false); exit(0); + if (_playAgain != null && _playAgain.isEnabled()) { // wait a little time before showing the button Timer timer = new Timer("playAgain", true); @@ -854,11 +855,11 @@ public abstract class Getdown extends Thread /** * Creates our user interface, which we avoid doing unless we actually have to update - * something. + * something. NOTE: this happens on the next UI tick, not immediately. * * @param reinit - if the interface should be reinitialized if it already exists. */ - protected void createInterface (final boolean reinit) + protected void createInterfaceAsync (final boolean reinit) { if (_silent || (_container != null && !reinit)) { return; @@ -1003,7 +1004,7 @@ public abstract class Getdown extends Thread protected void fail (String message) { _dead = true; - setStatus(message, stepToGlobalPercent(0), -1L, true); + setStatusAsync(message, stepToGlobalPercent(0), -1L, true); } /** @@ -1040,13 +1041,13 @@ public abstract class Getdown extends Thread } /** - * Update the status. + * Updates the status. NOTE: this happens on the next UI tick, not immediately. */ - protected void setStatus ( - final String message, final int percent, final long remaining, boolean createUI) + protected void setStatusAsync (final String message, final int percent, final long remaining, + boolean createUI) { if (_status == null && createUI) { - createInterface(false); + createInterfaceAsync(false); } EventQueue.invokeLater(new Runnable() { @@ -1198,7 +1199,7 @@ public abstract class Getdown extends Thread /** Used to pass progress on to our user interface. */ protected ProgressObserver _progobs = new ProgressObserver() { public void progress (int percent) { - setStatus(null, stepToGlobalPercent(percent), -1L, false); + setStatusAsync(null, stepToGlobalPercent(percent), -1L, false); } };