From d57b9e83857253a1479f89fca18ea5856db39fb7 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Sun, 2 Apr 2017 20:06:51 +0300 Subject: 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 Reviewed-by: Denis Shienkov --- src/serialport/qserialport_win.cpp | 6 +++--- 1 file 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; } -- cgit v1.2.1