1.0.24 - Circumventing deadlock during "Re-rip All" #22
Reproducing bug showed cross-thread UI manipulation. Added thread-safety to two commonly-called events: 1) beginning of rip -> pack() on main JFrame 2) updating of rip status -> Appending text to log text box
This commit is contained in:
parent
9ccbc8ac09
commit
b0d13d51b1
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
||||
<groupId>com.rarchives.ripme</groupId>
|
||||
<artifactId>ripme</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0.23</version>
|
||||
<version>1.0.24</version>
|
||||
<name>ripme</name>
|
||||
<url>http://rip.rarchives.com</url>
|
||||
<properties>
|
||||
|
@ -419,6 +419,9 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
||||
historyList.clearSelection();
|
||||
historyList.setSelectedIndex(i);
|
||||
Thread t = ripAlbum( (String) historyListModel.get(i) );
|
||||
if (t == null) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
synchronized (t) {
|
||||
t.wait();
|
||||
@ -562,7 +565,9 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
||||
StyleConstants.setForeground(sas, color);
|
||||
StyledDocument sd = logText.getStyledDocument();
|
||||
try {
|
||||
sd.insertString(sd.getLength(), text + "\n", sas);
|
||||
synchronized (this) {
|
||||
sd.insertString(sd.getLength(), text + "\n", sas);
|
||||
}
|
||||
} catch (BadLocationException e) { }
|
||||
|
||||
logText.setCaretPosition(sd.getLength());
|
||||
@ -579,7 +584,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
||||
}
|
||||
|
||||
private Thread ripAlbum(String urlString) {
|
||||
shutdownCleanup();
|
||||
//shutdownCleanup();
|
||||
if (!logPanel.isVisible()) {
|
||||
optionLog.doClick();
|
||||
}
|
||||
@ -603,7 +608,9 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
||||
statusProgress.setValue(100);
|
||||
openButton.setVisible(false);
|
||||
statusLabel.setVisible(true);
|
||||
mainFrame.pack();
|
||||
synchronized (this) {
|
||||
mainFrame.pack();
|
||||
}
|
||||
boolean failed = false;
|
||||
try {
|
||||
ripper = AbstractRipper.getRipper(url);
|
||||
@ -664,7 +671,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleEvent(StatusEvent evt) {
|
||||
private synchronized void handleEvent(StatusEvent evt) {
|
||||
if (ripper.isStopped()) {
|
||||
return;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import org.jsoup.nodes.Document;
|
||||
public class UpdateUtils {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(UpdateUtils.class);
|
||||
private static final String DEFAULT_VERSION = "1.0.23";
|
||||
private static final String DEFAULT_VERSION = "1.0.24";
|
||||
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";
|
||||
|
@ -16,6 +16,7 @@ public class InstagramRipperTest extends RippersTest {
|
||||
testURLs.put(new URL("http://instagram.com/Test_User"), "Test_User");
|
||||
testURLs.put(new URL("http://instagram.com/_test_user_"), "_test_user_");
|
||||
testURLs.put(new URL("http://instagram.com/-test-user-"), "-test-user-");
|
||||
testURLs.put(new URL("http://statigr.am/username"), "username");
|
||||
for (URL url : testURLs.keySet()) {
|
||||
InstagramRipper ripper = new InstagramRipper(url);
|
||||
assertEquals(testURLs.get(url), ripper.getGID(ripper.getURL()));
|
||||
|
Loading…
Reference in New Issue
Block a user