diff options
-rw-r--r-- | src/serialport/qserialport_win.cpp | 15 | ||||
-rw-r--r-- | src/serialport/qserialport_win_p.h | 2 |
2 files changed, 7 insertions, 10 deletions
diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp index 63d0a6d..71521af 100644 --- a/src/serialport/qserialport_win.cpp +++ b/src/serialport/qserialport_win.cpp @@ -580,9 +580,11 @@ void QSerialPortPrivate::_q_completeAsyncCommunication() error = true; } - // Start processing a caught error. - if (error || (EV_ERR & triggeredEventMask)) - processIoErrors(error); + if (error) + q->setError(QSerialPort::ResourceError); + + if (EV_ERR & triggeredEventMask) + handleLineStatusErrors(); if (!error) startAsyncRead(); @@ -740,15 +742,10 @@ void QSerialPortPrivate::emitReadyRead() emit q->readyRead(); } -void QSerialPortPrivate::processIoErrors(bool error) +void QSerialPortPrivate::handleLineStatusErrors() { Q_Q(QSerialPort); - if (error) { - q->setError(QSerialPort::ResourceError); - return; - } - DWORD errors = 0; if (!::ClearCommError(handle, &errors, NULL)) { q->setError(decodeSystemError()); diff --git a/src/serialport/qserialport_win_p.h b/src/serialport/qserialport_win_p.h index f6c3b0a..4e66685 100644 --- a/src/serialport/qserialport_win_p.h +++ b/src/serialport/qserialport_win_p.h @@ -88,7 +88,7 @@ public: bool setFlowControl(QSerialPort::FlowControl flowControl); bool setDataErrorPolicy(QSerialPort::DataErrorPolicy policy); - void processIoErrors(bool error); + void handleLineStatusErrors(); QSerialPort::SerialPortError decodeSystemError() const; void _q_completeAsyncCommunication(); |