diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java index 6d469e276da..9660ca721fe 100644 --- a/app/src/processing/app/debug/Compiler.java +++ b/app/src/processing/app/debug/Compiler.java @@ -401,10 +401,8 @@ private void execAsynchronously(List commandList) throws RunnerException { boolean compiling = true; while (compiling) { try { - if (in.thread != null) - in.thread.join(); - if (err.thread != null) - err.thread.join(); + in.join(); + err.join(); result = process.waitFor(); //System.out.println("result is " + result); compiling = false; diff --git a/app/src/processing/app/debug/MessageSiphon.java b/app/src/processing/app/debug/MessageSiphon.java index 79a0920d53a..12b1f993b77 100644 --- a/app/src/processing/app/debug/MessageSiphon.java +++ b/app/src/processing/app/debug/MessageSiphon.java @@ -85,8 +85,15 @@ public void run() { } } - + // Wait until the MessageSiphon thread is complete. + public void join() throws java.lang.InterruptedException { + // Grab a temp copy in case another thread nulls the "thread" + // member variable + Thread t = thread; + if (t != null) t.join(); + } + public Thread getThread() { return thread; -} + } } diff --git a/app/src/processing/app/debug/Sizer.java b/app/src/processing/app/debug/Sizer.java index d67728a3c85..67ce2080ca7 100644 --- a/app/src/processing/app/debug/Sizer.java +++ b/app/src/processing/app/debug/Sizer.java @@ -63,10 +63,8 @@ public long computeSize() throws RunnerException { while(running) { try { - if (in.thread != null) - in.thread.join(); - if (err.thread != null) - err.thread.join(); + in.join(); + err.join(); r = process.waitFor(); running = false; } catch (InterruptedException intExc) { }