aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-02-12 21:22:03 -0800
committerScott Jackson <daneren2005@gmail.com>2014-02-12 21:22:03 -0800
commitb28cf73fdf15b5fe47382b0832fa69b7070e14b6 (patch)
tree2fce4e0c0587fb4b18a9d0a6f0cf6300cade5408
parent6429e37c07e98a464a6eaad90b5808185f5ff0a4 (diff)
downloaddsub-b28cf73fdf15b5fe47382b0832fa69b7070e14b6.tar.gz
dsub-b28cf73fdf15b5fe47382b0832fa69b7070e14b6.tar.bz2
dsub-b28cf73fdf15b5fe47382b0832fa69b7070e14b6.zip
Fix the thread removal/cancel process
-rw-r--r--src/github/daneren2005/dsub/util/BackgroundTask.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/github/daneren2005/dsub/util/BackgroundTask.java b/src/github/daneren2005/dsub/util/BackgroundTask.java
index 9f5688bc..9f749116 100644
--- a/src/github/daneren2005/dsub/util/BackgroundTask.java
+++ b/src/github/daneren2005/dsub/util/BackgroundTask.java
@@ -159,7 +159,7 @@ public abstract class BackgroundTask<T> implements ProgressListener {
}
});
} catch(InterruptedException interrupt) {
- if(!isCancelled()) {
+ if(taskStart.get()) {
// Don't exit root thread if task cancelled
throw interrupt;
}
@@ -210,6 +210,7 @@ public abstract class BackgroundTask<T> implements ProgressListener {
task.execute();
} catch(InterruptedException stop) {
running = false;
+ threads.remove(Thread.currentThread());
} catch(Throwable t) {
Log.e(TAG, "Unexpected crash in BackgroundTask thread", t);
}