mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-18 07:52:14 +01:00
Merge pull request #96 from gandrewstone/master
Avoid null pointer exception during compilation (race condition). http://code.google.com/p/arduino/issues/detail?id=950
This commit is contained in:
commit
6d6f4424e4
@ -401,10 +401,8 @@ public class Compiler implements MessageConsumer {
|
||||
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;
|
||||
|
@ -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() {
|
||||
return thread;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,10 +63,8 @@ public class Sizer implements MessageConsumer {
|
||||
|
||||
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) { }
|
||||
|
Loading…
x
Reference in New Issue
Block a user