Fix an error when closing USB connection. This error raised several

times in the crash reports in the stats.
This commit is contained in:
Diego Prado Gesto 2017-12-01 13:17:36 +01:00
parent 7b4cb11240
commit e7ac2e37b4

View file

@ -394,7 +394,8 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
self._listen_thread.join() self._listen_thread.join()
except: except:
pass pass
self._serial.close() if self._serial is not None: # Avoid a race condition when a thread can change the value of self._serial to None
self._serial.close()
self._listen_thread = threading.Thread(target = self._listen) self._listen_thread = threading.Thread(target = self._listen)
self._listen_thread.daemon = True self._listen_thread.daemon = True