From b28cf73fdf15b5fe47382b0832fa69b7070e14b6 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Wed, 12 Feb 2014 21:22:03 -0800 Subject: Fix the thread removal/cancel process --- src/github/daneren2005/dsub/util/BackgroundTask.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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 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 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); } -- cgit v1.2.3