From d34fce4a5d12789ded107631e22cb6ef54d35eee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=BCmmel?= Date: Mon, 16 Jun 2014 20:59:22 +0200 Subject: Abort waitForReadyRead() when there is an error When in readNotification() or completeAsyncWrite() an error is emitted and the loop is not exited, this error signal will flood the eventloop. Change-Id: I77b8a4c337041258862b19a07917bef059c11cc1 Reviewed-by: Sergey Belyashov Reviewed-by: Denis Shienkov --- src/serialport/qserialport_unix.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/serialport/qserialport_unix.cpp b/src/serialport/qserialport_unix.cpp index 70c160b..f7d2af9 100644 --- a/src/serialport/qserialport_unix.cpp +++ b/src/serialport/qserialport_unix.cpp @@ -424,6 +424,7 @@ bool QSerialPortPrivate::waitForReadyRead(int msecs) stopWatch.start(); + error = QSerialPort::NoError; do { bool readyToRead = false; bool readyToWrite = false; @@ -443,6 +444,9 @@ bool QSerialPortPrivate::waitForReadyRead(int msecs) if (readyToWrite) completeAsyncWrite(); + if (error != QSerialPort::NoError) + return false; + } while (msecs == -1 || timeoutValue(msecs, stopWatch.elapsed()) > 0); return false; } -- cgit v1.2.1