diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2015-01-04 17:03:53 +0000 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2015-01-06 12:08:20 +0100 |
commit | 96d79d314c004afa2d84d4a32fd019d2d4770799 (patch) | |
tree | 3693d25f33928186f2f1a2ef22ffb923c6b1ffb0 | |
parent | cb7a9ca69f31658b29f1e8a77e31fd555c4e7e5d (diff) | |
download | qtserialport-96d79d314c004afa2d84d4a32fd019d2d4770799.tar.gz |
Do not touch of the read notifier after its creation
When are used the multiple opening and closing chains, then a read
notification can be stalled. The reason is in old heritage of a code
related to preventing of recursive calls. Thus, need just to remove this
old code. It is not the in-depth investigation of an issue but just a
workaround which can be improved in future.
Tested on Linux with on-board and socat serial ports using Qt5.
Task-number: QTBUG-43484
Change-Id: I04556fdde2775448b33d68f141f4328647c549c9
Reviewed-by: Laszlo Papp <lpapp@kde.org>
-rw-r--r-- | src/serialport/qserialport_unix.cpp | 24 | ||||
-rw-r--r-- | src/serialport/qserialport_unix_p.h | 4 |
2 files changed, 0 insertions, 28 deletions
diff --git a/src/serialport/qserialport_unix.cpp b/src/serialport/qserialport_unix.cpp index 648b6fc..cda73b2 100644 --- a/src/serialport/qserialport_unix.cpp +++ b/src/serialport/qserialport_unix.cpp @@ -150,9 +150,6 @@ QSerialPortPrivate::QSerialPortPrivate(QSerialPort *q) , descriptor(-1) , readNotifier(Q_NULLPTR) , writeNotifier(Q_NULLPTR) - , readPortNotifierCalled(false) - , readPortNotifierState(false) - , readPortNotifierStateSet(false) , emittedReadyRead(false) , emittedBytesWritten(false) , pendingBytesWritten(0) @@ -707,17 +704,6 @@ bool QSerialPortPrivate::readNotification() { Q_Q(QSerialPort); - // Prevent recursive calls - if (readPortNotifierCalled) { - if (!readPortNotifierStateSet) { - readPortNotifierStateSet = true; - readPortNotifierState = isReadNotificationEnabled(); - setReadNotificationEnabled(false); - } - } - - readPortNotifierCalled = true; - // Always buffered, read data from the port into the read buffer qint64 newBytes = readBuffer.size(); qint64 bytesToRead = policy == QSerialPort::IgnorePolicy ? ReadChunkSize : 1; @@ -762,16 +748,6 @@ bool QSerialPortPrivate::readNotification() emittedReadyRead = false; } - if (!hasData) - setReadNotificationEnabled(true); - - // reset the read port notifier state if we reentered inside the - // readyRead() connected slot. - if (readPortNotifierStateSet - && readPortNotifierState != isReadNotificationEnabled()) { - setReadNotificationEnabled(readPortNotifierState); - readPortNotifierStateSet = false; - } return true; } diff --git a/src/serialport/qserialport_unix_p.h b/src/serialport/qserialport_unix_p.h index 5ec6653..6b0e699 100644 --- a/src/serialport/qserialport_unix_p.h +++ b/src/serialport/qserialport_unix_p.h @@ -144,10 +144,6 @@ public: QSocketNotifier *readNotifier; QSocketNotifier *writeNotifier; - bool readPortNotifierCalled; - bool readPortNotifierState; - bool readPortNotifierStateSet; - bool emittedReadyRead; bool emittedBytesWritten; |