diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2017-04-02 20:06:51 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2017-04-09 17:59:49 +0000 |
commit | d57b9e83857253a1479f89fca18ea5856db39fb7 (patch) | |
tree | 9d091f14db1ae814ec1fce4064b923004ec00220 | |
parent | 1388d5f88224b15950d82075c527d20cea5dedd6 (diff) | |
download | qtserialport-d57b9e83857253a1479f89fca18ea5856db39fb7.tar.gz |
Create notifier only in end of successful initialization
... otherwise, this notifier's instance will be active even
if the serial port is not open.
Change-Id: Ieebb894a048f3ed89ac5d1c259e21bc790f5d387
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
-rw-r--r-- | src/serialport/qserialport_win.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp index 95edf2d..a69f975 100644 --- a/src/serialport/qserialport_win.cpp +++ b/src/serialport/qserialport_win.cpp @@ -694,15 +694,15 @@ 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()) - return false; - return true; } |