summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2014-05-29 17:13:12 +0400
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-06-02 09:59:21 +0200
commit91f818d6f7589553b45d680034445e3775191f2d (patch)
treeaa0eb4b9ba7ee36eefd216c58b88f73b86e2e62f
parent76e3365e3b0bc11a4766b4154fe46ad3dcf91251 (diff)
downloadqtserialport-91f818d6f7589553b45d680034445e3775191f2d.tar.gz
Fix the error message for TimeoutError on Windows
At timeouts from the waitForX() methods are set a wrong error string. Thing in that the WAIT_TIMEOUT constant is not a system error, therefore call of GetLastError() returns a code of a system error which was set by someone earlier. Thus, it is necessary to extract text representation of an error directly from the WAIT_TIMEOUT constant without relying on GetLastError(). Tested on Windows 7/8 using Qt4 and then Qt5. Change-Id: Id7fdc71c1b64c39eed658148bb1b66ac8806f119 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Dyami Caliri <dyami@dragonframe.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
-rw-r--r--src/serialport/qserialport_win.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp
index 71521af..5411d17 100644
--- a/src/serialport/qserialport_win.cpp
+++ b/src/serialport/qserialport_win.cpp
@@ -841,7 +841,7 @@ bool QSerialPortPrivate::waitAnyEvent(int msecs, bool *timedOut, HANDLE *trigger
msecs == -1 ? INFINITE : msecs);
if (waitResult == WAIT_TIMEOUT) {
*timedOut = true;
- q->setError(QSerialPort::TimeoutError);
+ q->setError(QSerialPort::TimeoutError, qt_error_string(WAIT_TIMEOUT));
return false;
}