QtcProcess: Add an assert about restarting from signal handler

Change-Id: I66ede2c8d726929ceb31a456eb8692e051c1b09e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Jarek Kobus
2022-09-08 14:59:43 +02:00
parent 9245c5ddbc
commit c94382aea5

View File

@@ -1128,6 +1128,9 @@ void QtcProcess::setUseCtrlCStub(bool enabled)
void QtcProcess::start()
{
QTC_ASSERT(state() == QProcess::NotRunning, return);
QTC_ASSERT(!(d->m_process && d->m_guard.isLocked()),
qWarning("Restarting the QtcProcess directly from one of its signal handlers will "
"lead to crash! Consider calling close() prior to direct restart."));
d->clearForRun();
d->m_state = QProcess::Starting;
ProcessInterface *processImpl = nullptr;