mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03: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:
@ -401,10 +401,8 @@ public class Compiler implements MessageConsumer {
|
|||||||
boolean compiling = true;
|
boolean compiling = true;
|
||||||
while (compiling) {
|
while (compiling) {
|
||||||
try {
|
try {
|
||||||
if (in.thread != null)
|
in.join();
|
||||||
in.thread.join();
|
err.join();
|
||||||
if (err.thread != null)
|
|
||||||
err.thread.join();
|
|
||||||
result = process.waitFor();
|
result = process.waitFor();
|
||||||
//System.out.println("result is " + result);
|
//System.out.println("result is " + result);
|
||||||
compiling = false;
|
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() {
|
public Thread getThread() {
|
||||||
return thread;
|
return thread;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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) { }
|
||||||
|
Reference in New Issue
Block a user