1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-03-15 12:29:26 +01:00

Fix for bug 950 -- NPE Compiler.java:407 -- also searched for any other instances & found two other cases of the same bug

This commit is contained in:
Andrew Stone 2012-06-08 16:49:31 -04:00
parent 958c835ef0
commit 5e75bd4a97
3 changed files with 13 additions and 12 deletions

View File

@ -401,12 +401,8 @@ public class Compiler implements MessageConsumer {
boolean compiling = true; boolean compiling = true;
while (compiling) { while (compiling) {
try { try {
Thread t = in.thread; in.join();
if (t != null) err.join();
t.join();
t = err.thread;
if (t != null)
t.join();
result = process.waitFor(); result = process.waitFor();
//System.out.println("result is " + result); //System.out.println("result is " + result);
compiling = false; compiling = false;

View File

@ -85,8 +85,15 @@ public class MessageSiphon implements Runnable {
} }
} }
// 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() { public Thread getThread() {
return thread; return thread;
} }
} }

View File

@ -63,10 +63,8 @@ public class Sizer implements MessageConsumer {
while(running) { while(running) {
try { try {
if (in.thread != null) in.join();
in.thread.join(); err.join();
if (err.thread != null)
err.thread.join();
r = process.waitFor(); r = process.waitFor();
running = false; running = false;
} catch (InterruptedException intExc) { } } catch (InterruptedException intExc) { }