summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Kümmel <syntheticpp@gmx.net>2014-06-16 20:59:22 +0200
committerPeter Kümmel <syntheticpp@gmx.net>2014-06-30 10:12:32 +0200
commitd34fce4a5d12789ded107631e22cb6ef54d35eee (patch)
tree667cf3311d97f8376c69a742e26a5f58ddcbf0ca
parentb3df3e8deaed821b101aef2c2367326107a6254a (diff)
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 <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
-rw-r--r--src/serialport/qserialport_unix.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/serialport/qserialport_unix.cpp b/src/serialport/qserialport_unix.cpp
index 70c160b6..f7d2af92 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;
}