diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-02-12 21:22:03 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-02-12 21:22:03 -0800 |
commit | b28cf73fdf15b5fe47382b0832fa69b7070e14b6 (patch) | |
tree | 2fce4e0c0587fb4b18a9d0a6f0cf6300cade5408 | |
parent | 6429e37c07e98a464a6eaad90b5808185f5ff0a4 (diff) | |
download | dsub-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.java | 3 |
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); } |