Skip to content

Commit

Permalink
Fix deadlock with main runnable also locking on controller.
Browse files Browse the repository at this point in the history
Former-commit-id: b4e195917e469af69df78493077ec8d42e647d15
  • Loading branch information
dkocher committed Oct 10, 2012
1 parent 4547023 commit 997088c
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions source/ch/cyberduck/ui/cocoa/SheetController.java
Expand Up @@ -137,7 +137,7 @@ protected boolean validateInput() {
*/
public void beginSheet() {
// Synchronize on parent controller. Only display one sheet at once.
synchronized(parent) {
synchronized(parent.window()) {
if(isMainThread()) {
// No need to call invoke on main thread
this.beginSheetImpl();
Expand All @@ -150,16 +150,14 @@ public void run() {
beginSheetImpl();
}
}, true);
synchronized(parent.window()) {
while(parent.hasSheet()) {
try {
log.debug("Sleeping:waitForSheetDismiss...");
parent.window().wait();
log.debug("Awakened:waitForSheetDismiss");
}
catch(InterruptedException e) {
log.error(e.getMessage());
}
while(parent.hasSheet()) {
try {
log.debug("Sleeping:waitForSheetDismiss...");
parent.window().wait();
log.debug("Awakened:waitForSheetDismiss");
}
catch(InterruptedException e) {
log.error(e.getMessage());
}
}
}
Expand Down

0 comments on commit 997088c

Please sign in to comment.