diff options
Diffstat (limited to 'src/serialport/qserialport_wince.cpp')
-rw-r--r-- | src/serialport/qserialport_wince.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/serialport/qserialport_wince.cpp b/src/serialport/qserialport_wince.cpp index 72e1652..86bb83f 100644 --- a/src/serialport/qserialport_wince.cpp +++ b/src/serialport/qserialport_wince.cpp @@ -91,21 +91,19 @@ signals: public: CommEventNotifier(DWORD mask, QSerialPortPrivate *d, QObject *parent) - : QThread(parent), dptr(d), running(true) { + : QThread(parent), dptr(d) { connect(this, SIGNAL(eventMask(quint32)), this, SLOT(processNotification(quint32))); ::SetCommMask(dptr->handle, mask); } virtual ~CommEventNotifier() { - running = false; ::SetCommMask(dptr->handle, 0); - wait(); } protected: void run() Q_DECL_OVERRIDE { DWORD mask = 0; - while (running) { + while (true) { if (::WaitCommEvent(dptr->handle, &mask, FALSE)) { // Wait until complete the operation changes the port settings, // see updateDcb(). @@ -139,7 +137,6 @@ private slots: private: QSerialPortPrivate *dptr; - mutable bool running; }; class WaitCommEventBreaker : public QThread @@ -229,7 +226,9 @@ bool QSerialPortPrivate::open(QIODevice::OpenMode mode) void QSerialPortPrivate::close() { if (eventNotifier) { - eventNotifier->deleteLater(); + eventNotifier->terminate(); + eventNotifier->wait(); + delete eventNotifier; eventNotifier = Q_NULLPTR; } |