ofxSerial using packetSerial. app crashes when unplug usb cable

[ from the opened issue: https://github.com/bakercp/ofxSerial/issues/15 ]

I used the addon and is working really fine! (Windows 10, OF 0.9.8 with ofxSerial master branch. ofxIO stable).

But when using the packetSerial mode / examples (COBS or SLIP), the OF app crashes when disconnected the USB cable. (example_packet_serial and example_SLIPPacketSerial)

I used the other examples templates without packetSerial, and when the cable is disconected the OF app do not crashes. Btw I used to reconnect the serial when the cable is plugged again, and the OF app contiues working fine.

I would like to handle this errors and avoid this crash, because usually the app window can’t be closed, and I have to reboot the machine to get it working again.
(I would like to use the packetSerial arduino library, so I don’t have to handle the start/finish bytes by hand…)


It should be related to the way ofx::IOPacketSerialDevice differs from the SerialSevice from other examples…