diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2015-08-05 10:48:39 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2015-08-06 10:49:18 +0000 |
commit | 1651383fd030189366f2e13de4da3d37319e705e (patch) | |
tree | c9d527986e0554697cd28e180308b11d955c305f | |
parent | a72a6179f652385b24d63ffc8f68b23a0262c268 (diff) | |
download | qtserialport-1651383fd030189366f2e13de4da3d37319e705e.tar.gz |
Delete the notifiers immediatelly on close
This avoid of the errors when the triggered notifier tries
to handle an already closed device descriptor.
Tested on Windows and Linux with the USB serial ports.
Change-Id: Iceb2e8c202b2b8d28fc87fa3a1b817df4caf39b9
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
-rw-r--r-- | src/serialport/qserialport_unix.cpp | 6 | ||||
-rw-r--r-- | src/serialport/qserialport_win.cpp | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/serialport/qserialport_unix.cpp b/src/serialport/qserialport_unix.cpp index 7a42764..612d84a 100644 --- a/src/serialport/qserialport_unix.cpp +++ b/src/serialport/qserialport_unix.cpp @@ -219,14 +219,12 @@ void QSerialPortPrivate::close() #endif if (readNotifier) { - readNotifier->setEnabled(false); - readNotifier->deleteLater(); + delete readNotifier; readNotifier = Q_NULLPTR; } if (writeNotifier) { - writeNotifier->setEnabled(false); - writeNotifier->deleteLater(); + delete writeNotifier; writeNotifier = Q_NULLPTR; } diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp index 0db4b8b..a5386c7 100644 --- a/src/serialport/qserialport_win.cpp +++ b/src/serialport/qserialport_win.cpp @@ -107,8 +107,10 @@ void QSerialPortPrivate::close() if (!::CancelIo(handle)) setError(getSystemError()); - if (notifier) - notifier->deleteLater(); + if (notifier) { + delete notifier; + notifier = Q_NULLPTR; + } readStarted = false; writeStarted = false; |