diff options
author | Qt CI Bot <qt_ci_bot@qt-project.org> | 2021-04-16 10:08:31 +0000 |
---|---|---|
committer | Qt CI Bot <qt_ci_bot@qt-project.org> | 2021-04-16 10:08:31 +0000 |
commit | 7e15d57eb45ae7a873185c37f952b8c3a5f423dd (patch) | |
tree | b4676e03086f049228065ca29b41091fcea37c75 /src/corelib/io | |
parent | 455994c2eef28ca4ed6d52103af47364e4145555 (diff) | |
parent | 063cdb9870ab8a9b0f1a3741a001c06289f02af4 (diff) |
Merge integration refs/builds/qtci/dev/1618515869
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qprocess_p.h | 3 | ||||
-rw-r--r-- | src/corelib/io/qprocess_win.cpp | 18 | ||||
-rw-r--r-- | src/corelib/io/qwindowspipereader.cpp | 11 | ||||
-rw-r--r-- | src/corelib/io/qwindowspipereader_p.h | 1 | ||||
-rw-r--r-- | src/corelib/io/qwindowspipewriter.cpp | 14 | ||||
-rw-r--r-- | src/corelib/io/qwindowspipewriter_p.h | 2 |
6 files changed, 23 insertions, 26 deletions
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h index 73db9423e6..f1572055f4 100644 --- a/src/corelib/io/qprocess_p.h +++ b/src/corelib/io/qprocess_p.h @@ -294,6 +294,9 @@ public: // private slots bool _q_canReadStandardOutput(); bool _q_canReadStandardError(); +#ifdef Q_OS_WIN + void _q_bytesWritten(qint64 bytes); +#endif bool _q_canWrite(); bool _q_startupNotification(); void _q_processDied(); diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index d0e57b51fa..388e163317 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -49,6 +49,7 @@ #include <qfileinfo.h> #include <qrandom.h> #include <qwineventnotifier.h> +#include <qscopedvaluerollback.h> #include <private/qsystemlibrary_p.h> #include <private/qthread_p.h> #include <qdebug.h> @@ -832,16 +833,25 @@ qint64 QProcessPrivate::pipeWriterBytesToWrite() const return stdinChannel.writer ? stdinChannel.writer->bytesToWrite() : qint64(0); } +void QProcessPrivate::_q_bytesWritten(qint64 bytes) +{ + Q_Q(QProcess); + + if (!emittedBytesWritten) { + QScopedValueRollback<bool> guard(emittedBytesWritten, true); + emit q->bytesWritten(bytes); + } + _q_canWrite(); +} + bool QProcessPrivate::writeToStdin() { Q_Q(QProcess); if (!stdinChannel.writer) { stdinChannel.writer = new QWindowsPipeWriter(stdinChannel.pipe[1], q); - QObject::connect(stdinChannel.writer, &QWindowsPipeWriter::bytesWritten, - q, &QProcess::bytesWritten); - QObjectPrivate::connect(stdinChannel.writer, &QWindowsPipeWriter::canWrite, - this, &QProcessPrivate::_q_canWrite); + QObjectPrivate::connect(stdinChannel.writer, &QWindowsPipeWriter::bytesWritten, + this, &QProcessPrivate::_q_bytesWritten); } else { if (stdinChannel.writer->isWriteOperationActive()) return true; diff --git a/src/corelib/io/qwindowspipereader.cpp b/src/corelib/io/qwindowspipereader.cpp index b8ea89b8e3..9030c3aaa1 100644 --- a/src/corelib/io/qwindowspipereader.cpp +++ b/src/corelib/io/qwindowspipereader.cpp @@ -39,7 +39,6 @@ ****************************************************************************/ #include "qwindowspipereader_p.h" -#include <qscopedvaluerollback.h> #include <qcoreapplication.h> #include <QMutexLocker> @@ -61,8 +60,7 @@ QWindowsPipeReader::QWindowsPipeReader(QObject *parent) readSequenceStarted(false), pipeBroken(false), readyReadPending(false), - winEventActPosted(false), - inReadyRead(false) + winEventActPosted(false) { ZeroMemory(&overlapped, sizeof(OVERLAPPED)); overlapped.hEvent = eventHandle; @@ -424,10 +422,8 @@ bool QWindowsPipeReader::consumePendingAndEmit(bool allowWinActPosting) if (state != Running) return false; - if (emitReadyRead && !inReadyRead) { - QScopedValueRollback<bool> guard(inReadyRead, true); + if (emitReadyRead) emit readyRead(); - } if (emitPipeClosed) { if (dwError != ERROR_BROKEN_PIPE && dwError != ERROR_PIPE_NOT_CONNECTED) emit winError(dwError, QLatin1String("QWindowsPipeReader::consumePendingAndEmit")); @@ -484,8 +480,7 @@ bool QWindowsPipeReader::waitForNotification(const QDeadlineTimer &deadline) /*! Waits for the completion of the asynchronous read operation. - Returns \c true, if we've emitted the readyRead signal (non-recursive case) - or readyRead will be emitted by the event loop (recursive case). + Returns \c true, if we've emitted the readyRead signal. */ bool QWindowsPipeReader::waitForReadyRead(int msecs) { diff --git a/src/corelib/io/qwindowspipereader_p.h b/src/corelib/io/qwindowspipereader_p.h index 8ae292da46..f02bf99880 100644 --- a/src/corelib/io/qwindowspipereader_p.h +++ b/src/corelib/io/qwindowspipereader_p.h @@ -125,7 +125,6 @@ private: bool pipeBroken; bool readyReadPending; bool winEventActPosted; - bool inReadyRead; }; QT_END_NAMESPACE diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp index 4b075549d0..f2f4dce056 100644 --- a/src/corelib/io/qwindowspipewriter.cpp +++ b/src/corelib/io/qwindowspipewriter.cpp @@ -39,7 +39,6 @@ ****************************************************************************/ #include "qwindowspipewriter_p.h" -#include <qscopedvaluerollback.h> #include <qcoreapplication.h> #include <QMutexLocker> @@ -56,8 +55,7 @@ QWindowsPipeWriter::QWindowsPipeWriter(HANDLE pipeWriteEnd, QObject *parent) stopped(true), writeSequenceStarted(false), bytesWrittenPending(false), - winEventActPosted(false), - inBytesWritten(false) + winEventActPosted(false) { ZeroMemory(&overlapped, sizeof(OVERLAPPED)); overlapped.hEvent = eventHandle; @@ -290,12 +288,7 @@ bool QWindowsPipeWriter::consumePendingAndEmit(bool allowWinActPosting) if (stopped) return false; - emit canWrite(); - if (!inBytesWritten) { - QScopedValueRollback<bool> guard(inBytesWritten, true); - emit bytesWritten(numberOfBytesWritten); - } - + emit bytesWritten(numberOfBytesWritten); return true; } @@ -317,8 +310,7 @@ bool QWindowsPipeWriter::waitForNotification(const QDeadlineTimer &deadline) /*! Waits for the completion of the asynchronous write operation. - Returns \c true, if we've emitted the bytesWritten signal (non-recursive case) - or bytesWritten will be emitted by the event loop (recursive case). + Returns \c true, if we've emitted the bytesWritten signal. */ bool QWindowsPipeWriter::waitForWrite(int msecs) { diff --git a/src/corelib/io/qwindowspipewriter_p.h b/src/corelib/io/qwindowspipewriter_p.h index d33c2753a8..cb78195a85 100644 --- a/src/corelib/io/qwindowspipewriter_p.h +++ b/src/corelib/io/qwindowspipewriter_p.h @@ -77,7 +77,6 @@ public: HANDLE syncEvent() const { return syncHandle; } Q_SIGNALS: - void canWrite(); void bytesWritten(qint64 bytes); protected: @@ -104,7 +103,6 @@ private: bool writeSequenceStarted; bool bytesWrittenPending; bool winEventActPosted; - bool inBytesWritten; }; QT_END_NAMESPACE |