From 91f818d6f7589553b45d680034445e3775191f2d Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Thu, 29 May 2014 17:13:12 +0400 Subject: 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 Reviewed-by: Dyami Caliri Reviewed-by: Denis Shienkov --- src/serialport/qserialport_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- cgit v1.2.1