summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaszlo Papp <lpapp@kde.org>2014-02-14 13:38:48 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-17 09:20:45 +0100
commit03546732fa696467d23b24224fad2822bc6a9043 (patch)
tree002c245050da820966da611619a71566ff78b07d
parentc0e0bd80c3876ce1f9b7db80b5873e78b94fe039 (diff)
downloadqtserialport-03546732fa696467d23b24224fad2822bc6a9043.tar.gz
Set error if the file buffer flushing fails on Windowsold/5.2
Change-Id: I58cf61540bc53e314988753a252cbc71003ce581 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
-rw-r--r--src/serialport/qserialport_win.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp
index ffc8aa4..be4530a 100644
--- a/src/serialport/qserialport_win.cpp
+++ b/src/serialport/qserialport_win.cpp
@@ -313,7 +313,20 @@ bool QSerialPortPrivate::setRequestToSend(bool set)
bool QSerialPortPrivate::flush()
{
- return startAsyncWrite() && ::FlushFileBuffers(handle);
+ Q_Q(QSerialPort);
+
+ bool returnValue = true;
+
+ if (!startAsyncWrite())
+ returnValue = false;
+
+ if (!::FlushFileBuffers(handle)) {
+ q->setError(decodeSystemError());
+ returnValue = false;
+ }
+
+ return returnValue;
+
}
bool QSerialPortPrivate::clear(QSerialPort::Directions directions)