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>
|
<groupId>com.rarchives.ripme</groupId>
|
||||||
<artifactId>ripme</artifactId>
|
<artifactId>ripme</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>1.0.23</version>
|
<version>1.0.24</version>
|
||||||
<name>ripme</name>
|
<name>ripme</name>
|
||||||
<url>http://rip.rarchives.com</url>
|
<url>http://rip.rarchives.com</url>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -419,6 +419,9 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
historyList.clearSelection();
|
historyList.clearSelection();
|
||||||
historyList.setSelectedIndex(i);
|
historyList.setSelectedIndex(i);
|
||||||
Thread t = ripAlbum( (String) historyListModel.get(i) );
|
Thread t = ripAlbum( (String) historyListModel.get(i) );
|
||||||
|
if (t == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
synchronized (t) {
|
synchronized (t) {
|
||||||
t.wait();
|
t.wait();
|
||||||
@ -562,7 +565,9 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
StyleConstants.setForeground(sas, color);
|
StyleConstants.setForeground(sas, color);
|
||||||
StyledDocument sd = logText.getStyledDocument();
|
StyledDocument sd = logText.getStyledDocument();
|
||||||
try {
|
try {
|
||||||
|
synchronized (this) {
|
||||||
sd.insertString(sd.getLength(), text + "\n", sas);
|
sd.insertString(sd.getLength(), text + "\n", sas);
|
||||||
|
}
|
||||||
} catch (BadLocationException e) { }
|
} catch (BadLocationException e) { }
|
||||||
|
|
||||||
logText.setCaretPosition(sd.getLength());
|
logText.setCaretPosition(sd.getLength());
|
||||||
@ -579,7 +584,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Thread ripAlbum(String urlString) {
|
private Thread ripAlbum(String urlString) {
|
||||||
shutdownCleanup();
|
//shutdownCleanup();
|
||||||
if (!logPanel.isVisible()) {
|
if (!logPanel.isVisible()) {
|
||||||
optionLog.doClick();
|
optionLog.doClick();
|
||||||
}
|
}
|
||||||
@ -603,7 +608,9 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
statusProgress.setValue(100);
|
statusProgress.setValue(100);
|
||||||
openButton.setVisible(false);
|
openButton.setVisible(false);
|
||||||
statusLabel.setVisible(true);
|
statusLabel.setVisible(true);
|
||||||
|
synchronized (this) {
|
||||||
mainFrame.pack();
|
mainFrame.pack();
|
||||||
|
}
|
||||||
boolean failed = false;
|
boolean failed = false;
|
||||||
try {
|
try {
|
||||||
ripper = AbstractRipper.getRipper(url);
|
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()) {
|
if (ripper.isStopped()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ import org.jsoup.nodes.Document;
|
|||||||
public class UpdateUtils {
|
public class UpdateUtils {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(UpdateUtils.class);
|
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 updateJsonURL = "http://rarchives.com/ripme.json";
|
||||||
private static final String updateJarURL = "http://rarchives.com/ripme.jar";
|
private static final String updateJarURL = "http://rarchives.com/ripme.jar";
|
||||||
private static final String mainFileName = "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://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()) {
|
for (URL url : testURLs.keySet()) {
|
||||||
InstagramRipper ripper = new InstagramRipper(url);
|
InstagramRipper ripper = new InstagramRipper(url);
|
||||||
assertEquals(testURLs.get(url), ripper.getGID(ripper.getURL()));
|
assertEquals(testURLs.get(url), ripper.getGID(ripper.getURL()));
|
||||||
|
Loading…
Reference in New Issue
Block a user