diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2018-04-05 17:10:26 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2018-04-09 10:33:22 +0000 |
commit | 0c988e14a90f3e1579365dc3dc99fbdd02ac3d4c (patch) | |
tree | c3a9705fcc95574763147ddf494a417b2115e082 | |
parent | ea1a95d3567f1264126bf34218a5532ffb5afc51 (diff) | |
download | qtserialport-0c988e14a90f3e1579365dc3dc99fbdd02ac3d4c.tar.gz |
Start overlapped I/O notifier before any asynchronous operationv5.11.0-beta4
This commit d57b9e83857253a1479f89fca18ea5856db39fb7 introduced
a regression, where the QSP may ignore all the read events when
the data comes to the device within opening. In this case, even
re-opening of a device does not help.
Reason is that the QWinOverlappedIoNotifier is enabled after than
the startAsyncCommunication() called, that probably, leads to
ignoring for all EV_RXCHAR events. A workaround is to enable the
notifier before than any of I/O operation called.
Task-number: QTBUG-67224
Change-Id: I21538fddc4dfd850c600e1d74f3c393a59a00549
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
-rw-r--r-- | src/serialport/qserialport_win.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp index f90a7ef..85dd8ee 100644 --- a/src/serialport/qserialport_win.cpp +++ b/src/serialport/qserialport_win.cpp @@ -691,15 +691,18 @@ inline bool QSerialPortPrivate::initialize(QIODevice::OpenMode mode) return false; } - if ((eventMask & EV_RXCHAR) && !startAsyncCommunication()) - return false; - notifier = new QWinOverlappedIoNotifier(q); QObjectPrivate::connect(notifier, &QWinOverlappedIoNotifier::notified, this, &QSerialPortPrivate::_q_notified); notifier->setHandle(handle); notifier->setEnabled(true); + if ((eventMask & EV_RXCHAR) && !startAsyncCommunication()) { + delete notifier; + notifier = nullptr; + return false; + } + return true; } |