Fix infinite loop and occasional crashes on shutdown in Win32 serial driver

This commit is contained in:
StrikerX3 2018-12-29 21:59:57 -02:00
parent c39df02a04
commit 11d870a555

View file

@ -16,7 +16,7 @@ void Win32SerialDriver::ReaderFunc(void *userData, uint8_t *buf, uint32_t len) {
while (len > 0) {
int lenRecv = min(driver->CanReceive(), len);
if (lenRecv == 0) {
continue;
break;
}
driver->Receive(buf, lenRecv);
len -= lenRecv;
@ -61,7 +61,7 @@ void Win32SerialDriver::Stop() {
}
void Win32SerialDriver::Close() {
m_comm->Stop();
m_comm->Stop(true);
Event(CHR_EVENT_CLOSED);
}