summaryrefslogtreecommitdiffstats
path: root/src/serialport/qserialport_win.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/serialport/qserialport_win.cpp')
-rw-r--r--src/serialport/qserialport_win.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp
index f90a7ef4..85dd8ee2 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;
}