summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2021-06-18 18:50:03 +0300
committerAlex Trotsenko <alex1973tr@gmail.com>2021-06-19 17:59:40 +0300
commita8d7ecf29520f75e6701a8698872debfa0b8d6cd (patch)
tree8b8c1c4e3ef17db3a50a3adffaa58df9949ebdac /src
parentff4244b540e38c31a474ac23dc1b1696f35730ea (diff)
QProcess/Win: cleanup startProcess()
Both the call to setProcessState(QProcess::NotRunning) and deleting the PROCESS_INFORMATION structure are redundant here. All this work was done by the previously executed cleanup() call. Change-Id: Iaf89f5edd2b661008a479d154e68974621b1b1eb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qprocess_win.cpp19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index 24031b9163..2daf8b50d7 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -550,14 +550,6 @@ void QProcessPrivate::startProcess()
{
Q_Q(QProcess);
- bool success = false;
-
- if (pid) {
- CloseHandle(pid->hThread);
- CloseHandle(pid->hProcess);
- delete pid;
- pid = 0;
- }
pid = new PROCESS_INFORMATION;
memset(pid, 0, sizeof(PROCESS_INFORMATION));
@@ -567,7 +559,6 @@ void QProcessPrivate::startProcess()
QString errorString = QProcess::tr("Process failed to start: %1").arg(qt_error_string());
cleanup();
setErrorAndEmit(QProcess::FailedToStart, errorString);
- q->setProcessState(QProcess::NotRunning);
return;
}
@@ -600,18 +591,12 @@ void QProcessPrivate::startProcess()
? nullptr : reinterpret_cast<const wchar_t *>(nativeWorkingDirectory.utf16()),
&startupInfo, pid
};
- success = callCreateProcess(&cpargs);
- QString errorString;
- if (!success) {
+ if (!callCreateProcess(&cpargs)) {
// Capture the error string before we do CloseHandle below
- errorString = QProcess::tr("Process failed to start: %1").arg(qt_error_string());
- }
-
- if (!success) {
+ QString errorString = QProcess::tr("Process failed to start: %1").arg(qt_error_string());
cleanup();
setErrorAndEmit(QProcess::FailedToStart, errorString);
- q->setProcessState(QProcess::NotRunning);
return;
}