Process: Get rid of internal event loop field

It was only needed for runBlocking() in event loop mode.
Handle it locally from the runBlocking() function.

Change-Id: I6eb0830b223977bbf0fc73f0cdf4f3b4cab962b5
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2024-01-20 21:03:13 +01:00
parent c86a19a56e
commit 6fa2e00425

View File

@@ -836,7 +836,6 @@ public:
ProcessResultData m_resultData; ProcessResultData m_resultData;
QTextCodec *m_codec = QTextCodec::codecForLocale(); QTextCodec *m_codec = QTextCodec::codecForLocale();
QEventLoop *m_eventLoop = nullptr;
ProcessResult m_result = ProcessResult::StartFailed; ProcessResult m_result = ProcessResult::StartFailed;
ChannelBuffer m_stdOut; ChannelBuffer m_stdOut;
ChannelBuffer m_stdErr; ChannelBuffer m_stdErr;
@@ -1865,8 +1864,6 @@ void Process::runBlocking(EventLoopMode eventLoopMode)
QGuiApplication::setOverrideCursor(Qt::WaitCursor); QGuiApplication::setOverrideCursor(Qt::WaitCursor);
#endif #endif
QEventLoop eventLoop(this); QEventLoop eventLoop(this);
QTC_ASSERT(!d->m_eventLoop, return);
d->m_eventLoop = &eventLoop;
// Queue the call to start() so that it's executed after the nested event loop is started, // Queue the call to start() so that it's executed after the nested event loop is started,
// otherwise it fails on Windows with QProcessImpl. See QTCREATORBUG-30066. // otherwise it fails on Windows with QProcessImpl. See QTCREATORBUG-30066.
@@ -1888,8 +1885,9 @@ void Process::runBlocking(EventLoopMode eventLoopMode)
QTimer::singleShot(d->m_timeoutInSeconds * 1000, &eventLoop, timeoutHandler); QTimer::singleShot(d->m_timeoutInSeconds * 1000, &eventLoop, timeoutHandler);
} }
connect(this, &Process::done, &eventLoop, [&eventLoop] { eventLoop.quit(); });
eventLoop.exec(QEventLoop::ExcludeUserInputEvents); eventLoop.exec(QEventLoop::ExcludeUserInputEvents);
d->m_eventLoop = nullptr;
#ifdef QT_GUI_LIB #ifdef QT_GUI_LIB
if (isGuiEnabled()) if (isGuiEnabled())
QGuiApplication::restoreOverrideCursor(); QGuiApplication::restoreOverrideCursor();
@@ -2066,8 +2064,6 @@ void ProcessPrivate::handleDone(const ProcessResultData &data)
break; break;
} }
} }
if (m_eventLoop)
m_eventLoop->quit();
m_stdOut.handleRest(); m_stdOut.handleRest();
m_stdErr.handleRest(); m_stdErr.handleRest();