summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qprocess.cpp
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2020-12-02 17:22:10 +0200
committerAlex Trotsenko <alex1973tr@gmail.com>2020-12-06 22:28:31 +0200
commitec02de374da3f796a2155b45779be222a90be2cd (patch)
tree35465504521bb2162506e46231f11e2754703091 /src/corelib/io/qprocess.cpp
parent895940a42505e4383971e84954a0deaebad3dbab (diff)
QProcess: simplify the logic around _q_processDied()
Both on Unix and Windows, _q_processDied() unconditionally releases all resources associated with the terminated child process, resets QProcess to the initial state, and emits finished() signal. Thus, we can omit reporting success, which also eliminates the related checks from callers. Change-Id: I40e32d1a9ccc8d488be6badba934355d734a8abd Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src/corelib/io/qprocess.cpp')
-rw-r--r--src/corelib/io/qprocess.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 8b29a8964f..e7d671abc8 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1057,15 +1057,14 @@ bool QProcessPrivate::_q_canWrite()
/*!
\internal
*/
-bool QProcessPrivate::_q_processDied()
+void QProcessPrivate::_q_processDied()
{
Q_Q(QProcess);
#if defined QPROCESS_DEBUG
qDebug("QProcessPrivate::_q_processDied()");
#endif
#ifdef Q_OS_UNIX
- if (!waitForDeadChild())
- return false;
+ waitForDeadChild();
#endif
#ifdef Q_OS_WIN
if (processFinishedNotifier)
@@ -1078,7 +1077,7 @@ bool QProcessPrivate::_q_processDied()
// give it a chance to emit started() or errorOccurred(FailedToStart).
if (processState == QProcess::Starting) {
if (!_q_startupNotification())
- return true;
+ return;
}
if (dying) {
@@ -1086,7 +1085,7 @@ bool QProcessPrivate::_q_processDied()
// reentering this slot recursively by calling waitForFinished()
// or opening a dialog inside slots connected to the readyRead
// signals emitted below.
- return true;
+ return;
}
dying = true;
@@ -1119,7 +1118,6 @@ bool QProcessPrivate::_q_processDied()
#if defined QPROCESS_DEBUG
qDebug("QProcessPrivate::_q_processDied() process is dead");
#endif
- return true;
}
/*!