summaryrefslogtreecommitdiff
path: root/ao-tools/altosui/AltosLog.java
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2010-11-20 17:40:49 +1000
committerAnthony Towns <aj@erisian.com.au>2010-11-20 17:40:49 +1000
commit081fbd5715f9d3d81d98e149fb95d40447c07a79 (patch)
tree073885e98179ef663f08aaaf52cb7e74c2c66427 /ao-tools/altosui/AltosLog.java
parent90b9bc4475011bead7117ed72fa5efa0f77b2813 (diff)
parent7920ed5c34b088f45ce4213b061ddd1ffe22cee8 (diff)
Merge branch 'buttonbox' of git://git.gag.com/fw/altos into buttonbox
Conflicts: ao-tools/altosui/AltosFlightUI.java
Diffstat (limited to 'ao-tools/altosui/AltosLog.java')
-rw-r--r--ao-tools/altosui/AltosLog.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/ao-tools/altosui/AltosLog.java b/ao-tools/altosui/AltosLog.java
index 137147d5..dd147d21 100644
--- a/ao-tools/altosui/AltosLog.java
+++ b/ao-tools/altosui/AltosLog.java
@@ -36,15 +36,22 @@ class AltosLog implements Runnable {
FileWriter log_file;
Thread log_thread;
- void close() {
+ private void close_log_file() {
if (log_file != null) {
try {
log_file.close();
} catch (IOException io) {
}
+ log_file = null;
}
- if (log_thread != null)
+ }
+
+ void close() {
+ close_log_file();
+ if (log_thread != null) {
log_thread.interrupt();
+ log_thread = null;
+ }
}
boolean open (AltosTelemetry telem) throws IOException {
@@ -74,7 +81,7 @@ class AltosLog implements Runnable {
try {
AltosTelemetry telem = new AltosTelemetry(line.line);
if (telem.serial != serial || telem.flight != flight || log_file == null) {
- close();
+ close_log_file();
serial = telem.serial;
flight = telem.flight;
open(telem);