diff options
author | Joerg Bornemann <joerg.bornemann@theqtcompany.com> | 2015-04-09 11:24:15 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@theqtcompany.com> | 2015-04-13 14:51:57 +0000 |
commit | 96cc8eec9b32f4e80c2d748687c485bc79133d39 (patch) | |
tree | 5902bb2cc6aa7e70070c46282169be3ae57a239f /src/corelib/io/qprocess_win.cpp | |
parent | 95b481ea6dfa901c23b012085527769f9b5823c9 (diff) |
remove the "wonderful Windows notifier" from QProcess
Remove the 100 ms timer that was used to nudge QProcess to write data
to the child's stdin. Instead, react on the canWrite() signal of
QWindowsPipeWriter.
QProcess::writeData needs to call _q_canWrite via the event loop to
start the write operation. The socket notifier code was never in use on
Windows.
Task-number: QTBUG-45457
Change-Id: I99c956ba5f2169f80068eee206543ceb9788b2e0
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'src/corelib/io/qprocess_win.cpp')
-rw-r--r-- | src/corelib/io/qprocess_win.cpp | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index 563286e3e9..cef961ecbd 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -41,7 +41,6 @@ #include <qelapsedtimer.h> #include <qfileinfo.h> #include <qregexp.h> -#include <qtimer.h> #include <qwineventnotifier.h> #include <private/qthread_p.h> #include <qdebug.h> @@ -58,8 +57,6 @@ QT_BEGIN_NAMESPACE //#define QPROCESS_DEBUG -#define NOTIFYTIMEOUT 100 - static void qt_create_pipe(Q_PIPE *pipe, bool isInputPipe) { // Anomymous pipes do not support asynchronous I/O. Thus we @@ -543,9 +540,6 @@ void QProcessPrivate::startProcess() processFinishedNotifier = new QWinEventNotifier(pid->hProcess, q); QObject::connect(processFinishedNotifier, SIGNAL(activated(HANDLE)), q, SLOT(_q_processDied())); processFinishedNotifier->setEnabled(true); - notifier = new QTimer(q); - QObject::connect(notifier, SIGNAL(timeout()), q, SLOT(_q_notified())); - notifier->start(NOTIFYTIMEOUT); } _q_startupNotification(); @@ -810,6 +804,8 @@ qint64 QProcessPrivate::writeToStdin(const char *data, qint64 maxlen) if (!stdinChannel.writer) { stdinChannel.writer = new QWindowsPipeWriter(stdinChannel.pipe[1], q); + QObjectPrivate::connect(stdinChannel.writer, &QWindowsPipeWriter::canWrite, + this, &QProcessPrivate::_q_canWrite); stdinChannel.writer->start(); } @@ -828,17 +824,6 @@ bool QProcessPrivate::waitForWrite(int msecs) return false; } -void QProcessPrivate::_q_notified() -{ - notifier->stop(); - - if (!stdinChannel.buffer.isEmpty() && (!stdinChannel.writer || stdinChannel.writer->waitForWrite(0))) - _q_canWrite(); - - if (processState != QProcess::NotRunning) - notifier->start(NOTIFYTIMEOUT); -} - bool QProcessPrivate::startDetached(const QString &program, const QStringList &arguments, const QString &workingDir, qint64 *pid) { QString args = qt_create_commandline(program, arguments); |