diff options
author | Alex Trotsenko <alex1973tr@gmail.com> | 2021-01-04 17:46:21 +0200 |
---|---|---|
committer | Alex Trotsenko <alex1973tr@gmail.com> | 2021-01-08 14:29:43 +0200 |
commit | 423e6c3635a5e0f88f38cbf0af7474bc62b26323 (patch) | |
tree | 79762dbf99cf07739a2a73888bc977b8770e0c09 /src/corelib/io/qprocess.cpp | |
parent | 7fea8a079f65b090c7d82e0d285ef85e30328da7 (diff) |
QProcess/Unix: consolidate process state tracking socket notifiers
There is no reason to have the startup notifier and the death notifier
be active at the same time, as the former will detect death as well.
Previously, these notifiers were racing, but _q_processDied() ordered
signals by calling _q_startupNotification() manually. Thus, the
started()/finished() sequence was always emitted if the child process
was killed anywhere. Now this ordering is simply not necessary anymore.
This makes it possible to reuse the startup notifier for death
notification.
Change-Id: I5ebed9b5f28b19fe56c80498977a3b21be9288fd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src/corelib/io/qprocess.cpp')
-rw-r--r-- | src/corelib/io/qprocess.cpp | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 2e3bd9cf59..5da0df8a4e 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -879,13 +879,9 @@ void QProcessPrivate::cleanup() delete stdinChannel.notifier; stdinChannel.notifier = nullptr; } - if (startupSocketNotifier) { - delete startupSocketNotifier; - startupSocketNotifier = nullptr; - } - if (deathNotifier) { - delete deathNotifier; - deathNotifier = nullptr; + if (stateNotifier) { + delete stateNotifier; + stateNotifier = nullptr; } closeChannel(&stdoutChannel); closeChannel(&stderrChannel); @@ -1150,14 +1146,6 @@ void QProcessPrivate::_q_processDied() drainOutputPipes(); #endif - // the process may have died before it got a chance to report that it was - // either running or stopped, so we will call _q_startupNotification() and - // give it a chance to emit started() or errorOccurred(FailedToStart). - if (processState == QProcess::Starting) { - if (!_q_startupNotification()) - return; - } - if (dying) { // at this point we know the process is dead. prevent // reentering this slot recursively by calling waitForFinished() |