diff options
-rw-r--r-- | src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java index fa21f9f0..192ee04c 100644 --- a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java +++ b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java @@ -169,17 +169,21 @@ public class DownloadServiceLifecycleSupport { new Thread(new Runnable(){ @Override public void run() { + boolean locked = false; try { // Make sure everything is ready to go before handling event if(!setup.get()) { + locked = true; lock.lock(); } handleKeyEvent(event); } finally { - lock.unlock(); + if(locked) { + lock.unlock(); + } } } - }); + }).start(); } } } |