From bb8f62148052e1208b4fe00a3fc6f25fa74432ac Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 16 Apr 2015 13:46:45 +0200 Subject: remove emitReadyReadTimer from QWindowsPipeReader The zero timeout singleshot timer emitReadyReadTimer was used to emit the readyRead signal via the event loop in case of a synchronous read. In that particular case, ReadFile would return successfully, and the notified slot would not be called. Now, that we use an I/O completion port, the notified slot is always called, even in the synchronous case. The emitReadyReadTimer is not needed anymore. This is also supported by the fact that the timer is immediately stopped in notified() after it was started in completeAsyncRead(). Change-Id: I93bcde5f067bf89a1d49005a3fddda4c8c8c95fc Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qwindowspipereader_p.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/corelib/io/qwindowspipereader_p.h') diff --git a/src/corelib/io/qwindowspipereader_p.h b/src/corelib/io/qwindowspipereader_p.h index ecc6974efa..6eead60fd5 100644 --- a/src/corelib/io/qwindowspipereader_p.h +++ b/src/corelib/io/qwindowspipereader_p.h @@ -47,7 +47,6 @@ #include #include -#include #include #include @@ -100,7 +99,6 @@ private: QRingBuffer readBuffer; int actualReadBufferSize; bool readSequenceStarted; - QTimer *emitReadyReadTimer; bool pipeBroken; bool readyReadEmitted; }; -- cgit v1.2.3 From a7f1c97d6096b7f9cc44df275b20d91cc75f7347 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 16 Apr 2015 16:18:45 +0200 Subject: inline QWindowsPipeReader::completeAsyncRead There's exactly one caller for this private method, and future code will be a bit simpler after moving the code to the calling site. Change-Id: Ibc65f91c770f9f29b317ceddb39a67d52106da33 Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qwindowspipereader_p.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/corelib/io/qwindowspipereader_p.h') diff --git a/src/corelib/io/qwindowspipereader_p.h b/src/corelib/io/qwindowspipereader_p.h index 6eead60fd5..7651093b05 100644 --- a/src/corelib/io/qwindowspipereader_p.h +++ b/src/corelib/io/qwindowspipereader_p.h @@ -88,7 +88,6 @@ private Q_SLOTS: void notified(quint32 numberOfBytesRead, quint32 errorCode, OVERLAPPED *notifiedOverlapped); private: - bool completeAsyncRead(DWORD bytesRead, DWORD errorCode); DWORD checkPipeState(); private: -- cgit v1.2.3 From 5ce567c536fde6b7cb93657d14df404f3e270119 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 15 Apr 2015 15:37:24 +0200 Subject: let QWindowsPipeReader::stop() cancel the current I/O operation In rare cases the I/O operation was still running after the destructor was running, which then modified free'd memory and caused a malformed heap. To prevent this, we ensure that QWindowsPipeReader::stop() cancels a running I/O operation and sets the readSequenceStarted flag correctly. Also, we prevent the start of a new read operation after we called stop(). Change-Id: If8a28bdf23a39a0e88c1770a6f66e2b24ea426bb Task-number: QTBUG-45601 Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qwindowspipereader_p.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib/io/qwindowspipereader_p.h') diff --git a/src/corelib/io/qwindowspipereader_p.h b/src/corelib/io/qwindowspipereader_p.h index 7651093b05..b0a23e1a51 100644 --- a/src/corelib/io/qwindowspipereader_p.h +++ b/src/corelib/io/qwindowspipereader_p.h @@ -97,6 +97,7 @@ private: qint64 readBufferMaxSize; QRingBuffer readBuffer; int actualReadBufferSize; + bool stopped; bool readSequenceStarted; bool pipeBroken; bool readyReadEmitted; -- cgit v1.2.3