QtcProcess: Set Starting state a bit later

To avoid resetting it back again to NotRunning
in case an assert triggered.

Change-Id: I4ba52bb64fd3b782013cf47d9149bef7f8a231af
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-10-25 11:49:47 +02:00
parent b31249d753
commit ef6020ae0f

View File

@@ -1095,16 +1095,16 @@ void QtcProcess::start()
qWarning("Restarting the QtcProcess directly from one of its signal handlers will " qWarning("Restarting the QtcProcess directly from one of its signal handlers will "
"lead to crash! Consider calling close() prior to direct restart.")); "lead to crash! Consider calling close() prior to direct restart."));
d->clearForRun(); d->clearForRun();
d->m_state = QProcess::Starting;
ProcessInterface *processImpl = nullptr; ProcessInterface *processImpl = nullptr;
if (d->m_setup.m_commandLine.executable().needsDevice()) { if (d->m_setup.m_commandLine.executable().needsDevice()) {
QTC_ASSERT(s_deviceHooks.processImplHook, d->m_state = QProcess::NotRunning; return); QTC_ASSERT(s_deviceHooks.processImplHook, return);
processImpl = s_deviceHooks.processImplHook(commandLine().executable()); processImpl = s_deviceHooks.processImplHook(commandLine().executable());
} else { } else {
processImpl = d->createProcessInterface(); processImpl = d->createProcessInterface();
} }
QTC_ASSERT(processImpl, d->m_state = QProcess::NotRunning; return); QTC_ASSERT(processImpl, return);
d->setProcessInterface(processImpl); d->setProcessInterface(processImpl);
d->m_state = QProcess::Starting;
d->m_process->m_setup = d->m_setup; d->m_process->m_setup = d->m_setup;
d->m_process->m_setup.m_commandLine = d->fullCommandLine(); d->m_process->m_setup.m_commandLine = d->fullCommandLine();
d->m_process->m_setup.m_environment = d->fullEnvironment(); d->m_process->m_setup.m_environment = d->fullEnvironment();