diff options
Diffstat (limited to 'src/github')
-rw-r--r-- | src/github/daneren2005/dsub/util/BackgroundTask.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/github/daneren2005/dsub/util/BackgroundTask.java b/src/github/daneren2005/dsub/util/BackgroundTask.java index 6ca8ea4c..63515f19 100644 --- a/src/github/daneren2005/dsub/util/BackgroundTask.java +++ b/src/github/daneren2005/dsub/util/BackgroundTask.java @@ -136,10 +136,12 @@ public abstract class BackgroundTask<T> implements ProgressListener { public void cancel() { cancelled = true; + if(task != null) { + task.cancel(); + } + if(cancelListener != null) { cancelListener.onCancel(); - } else if(task != null) { - task.cancel(); } } public boolean isCancelled() { @@ -253,6 +255,7 @@ public abstract class BackgroundTask<T> implements ProgressListener { Task task = queue.take(); task.execute(); } catch(InterruptedException stop) { + Log.e(TAG, "Thread died"); running = false; threads.remove(Thread.currentThread()); } catch(Throwable t) { |