From 15142dd8980d24f1642c67056a71d3529e75ec93 Mon Sep 17 00:00:00 2001 From: 4pr0n Date: Thu, 12 Jun 2014 20:41:45 -0700 Subject: [PATCH] 1.0.63 - Hopefully fixing dead-lock issue while re-ripping all for #22 --- pom.xml | 2 +- .../com/rarchives/ripme/ui/MainWindow.java | 35 ++++++++++++------- .../com/rarchives/ripme/ui/UpdateUtils.java | 2 +- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index 4f707789..39ef35c2 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rarchives.ripme ripme jar - 1.0.62 + 1.0.63 ripme http://rip.rarchives.com diff --git a/src/main/java/com/rarchives/ripme/ui/MainWindow.java b/src/main/java/com/rarchives/ripme/ui/MainWindow.java index 878932fa..af07c25b 100644 --- a/src/main/java/com/rarchives/ripme/ui/MainWindow.java +++ b/src/main/java/com/rarchives/ripme/ui/MainWindow.java @@ -160,7 +160,7 @@ public class MainWindow implements Runnable, RipStatusHandler { } public void run() { - mainFrame.pack(); + pack(); mainFrame.setLocationRelativeTo(null); mainFrame.setVisible(true); } @@ -191,7 +191,16 @@ public class MainWindow implements Runnable, RipStatusHandler { private void statusWithColor(String text, Color color) { statusLabel.setForeground(color); statusLabel.setText(text); - mainFrame.pack(); + pack(); + } + + private void pack() { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + mainFrame.pack(); + } + }); } private void createUI(Container pane) { @@ -405,7 +414,7 @@ public class MainWindow implements Runnable, RipStatusHandler { ripTextfield.setEnabled(true); statusProgress.setValue(0); statusProgress.setVisible(false); - mainFrame.pack(); + pack(); statusProgress.setValue(0); status("Ripping interrupted"); appendLog("Ripper interrupted", Color.RED); @@ -421,7 +430,7 @@ public class MainWindow implements Runnable, RipStatusHandler { optionLog.setFont(optionLog.getFont().deriveFont(Font.BOLD)); optionHistory.setFont(optionLog.getFont().deriveFont(Font.PLAIN)); optionConfiguration.setFont(optionLog.getFont().deriveFont(Font.PLAIN)); - mainFrame.pack(); + pack(); } }); optionHistory.addActionListener(new ActionListener() { @@ -433,7 +442,7 @@ public class MainWindow implements Runnable, RipStatusHandler { optionLog.setFont(optionLog.getFont().deriveFont(Font.PLAIN)); optionHistory.setFont(optionLog.getFont().deriveFont(Font.BOLD)); optionConfiguration.setFont(optionLog.getFont().deriveFont(Font.PLAIN)); - mainFrame.pack(); + pack(); } }); optionConfiguration.addActionListener(new ActionListener() { @@ -445,7 +454,7 @@ public class MainWindow implements Runnable, RipStatusHandler { optionLog.setFont(optionLog.getFont().deriveFont(Font.PLAIN)); optionHistory.setFont(optionLog.getFont().deriveFont(Font.PLAIN)); optionConfiguration.setFont(optionLog.getFont().deriveFont(Font.BOLD)); - mainFrame.pack(); + pack(); } }); historyButtonRemove.addActionListener(new ActionListener() { @@ -732,9 +741,7 @@ public class MainWindow implements Runnable, RipStatusHandler { statusProgress.setValue(100); openButton.setVisible(false); statusLabel.setVisible(true); - synchronized (this) { - mainFrame.pack(); - } + pack(); boolean failed = false; try { ripper = AbstractRipper.getRipper(url); @@ -746,7 +753,9 @@ public class MainWindow implements Runnable, RipStatusHandler { } if (!failed) { try { - ripTextfield.setText(ripper.getURL().toExternalForm()); + synchronized (this) { + ripTextfield.setText(ripper.getURL().toExternalForm()); + } status("Starting rip..."); ripper.setObserver((RipStatusHandler) this); Thread t = new Thread(ripper); @@ -768,7 +777,7 @@ public class MainWindow implements Runnable, RipStatusHandler { stopButton.setVisible(false); ripTextfield.setEnabled(true); statusProgress.setValue(0); - mainFrame.pack(); + pack(); return null; } @@ -826,7 +835,7 @@ public class MainWindow implements Runnable, RipStatusHandler { statusProgress.setValue(0); statusProgress.setVisible(false); openButton.setVisible(false); - mainFrame.pack(); + pack(); statusWithColor("Error: " + (String) msg.getObject(), Color.RED); break; @@ -863,7 +872,7 @@ public class MainWindow implements Runnable, RipStatusHandler { } } }); - mainFrame.pack(); + pack(); break; case COMPLETED_BYTES: // Update completed bytes diff --git a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java index e3c9787f..9f3cb349 100644 --- a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java +++ b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java @@ -21,7 +21,7 @@ import com.rarchives.ripme.utils.Utils; public class UpdateUtils { private static final Logger logger = Logger.getLogger(UpdateUtils.class); - private static final String DEFAULT_VERSION = "1.0.62"; + private static final String DEFAULT_VERSION = "1.0.63"; private static final String updateJsonURL = "http://rarchives.com/ripme.json"; private static final String updateJarURL = "http://rarchives.com/ripme.jar"; private static final String mainFileName = "ripme.jar";