QProcess/Win: clean up death notifier teardown
To avoid the mostly hypothetical possibility of failure, delete the processFinishedNotifier before closing the handle on which it operates. Previously, because of this, we explicitly disabled the notifier in the processFinished() function, which made the code unclear. Now, we can remove that safely, because cleanup() works correctly, and doing it before calling findExitCode() was not necessary to start with. Change-Id: Ia7095ded2c7eba8f4d738c6b87c7be41aa3cbbc8 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
This commit is contained in:
parent
4ff41e6ff8
commit
161e8f4d5d
@ -849,12 +849,6 @@ void QProcessPrivate::cleanup()
|
||||
{
|
||||
q_func()->setProcessState(QProcess::NotRunning);
|
||||
#ifdef Q_OS_WIN
|
||||
if (pid) {
|
||||
CloseHandle(pid->hThread);
|
||||
CloseHandle(pid->hProcess);
|
||||
delete pid;
|
||||
pid = 0;
|
||||
}
|
||||
if (stdinWriteTrigger) {
|
||||
delete stdinWriteTrigger;
|
||||
stdinWriteTrigger = 0;
|
||||
@ -863,9 +857,15 @@ void QProcessPrivate::cleanup()
|
||||
delete processFinishedNotifier;
|
||||
processFinishedNotifier = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
if (pid) {
|
||||
CloseHandle(pid->hThread);
|
||||
CloseHandle(pid->hProcess);
|
||||
delete pid;
|
||||
pid = nullptr;
|
||||
}
|
||||
#else
|
||||
pid = 0;
|
||||
#endif
|
||||
|
||||
if (stdoutChannel.notifier) {
|
||||
delete stdoutChannel.notifier;
|
||||
@ -1165,10 +1165,6 @@ void QProcessPrivate::processFinished()
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
waitForDeadChild();
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
if (processFinishedNotifier)
|
||||
processFinishedNotifier->setEnabled(false);
|
||||
#endif
|
||||
findExitCode();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user