From: Keith Packard Date: Sat, 14 Jun 2014 21:38:00 +0000 (-0700) Subject: altosuilib: Make sure only one thread is closing serial device X-Git-Tag: 1.4~31 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=19273a4a341342ca6b5d65cfc490d92cbf23356f altosuilib: Make sure only one thread is closing serial device Multiple closers can cause a crash by freeing the libaltos device twice Signed-off-by: Keith Packard --- diff --git a/altosuilib/AltosSerial.java b/altosuilib/AltosSerial.java index 0632ca70..60e15bdb 100644 --- a/altosuilib/AltosSerial.java +++ b/altosuilib/AltosSerial.java @@ -117,7 +117,7 @@ public class AltosSerial extends AltosLink { SwingUtilities.invokeLater(r); } - private void close_serial() { + private synchronized void close_serial() { synchronized (devices_opened) { devices_opened.remove(device.getPath()); }