diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2023-07-19 09:47:43 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2023-07-27 10:14:39 +0000 |
commit | ddbfdb6f3f04f21305cfef56783cf1b451bcab9a (patch) | |
tree | 47b69cb50b2d226988cb988023bee33550432a17 /src/plugins/projectexplorer/appoutputpane.cpp | |
parent | 323e94c2fa91aeef7e6030ab0ef4909eedd3e358 (diff) |
ProjectExplorer: Fix 10 seconds hang on shutdown
Delete the RunControl directly when it's not running.
Do it in two cases: when tab is closed and when
tab is reused with a new RunControl instance.
In other case, queue the call to initiateStop,
so that any possible deleteLater() is called when
the nested event loop of the shutdown is already spinning.
It looks like the amended changes introduced the hang
when compiled against Qt 6.5. When compiled against
Qt 6.4 the regression doesn't occur.
The regression is caused by
449b45ff34ce4a45e5d6a24967566f69f43ebbb6.
Amends c1f6d7044589f7842d19fc7b44574152ce72a20f
Amends 6e16512eba2c39baa714fa253843b2171ba24f47
Change-Id: Icb3ba757f32bccb3daae675b2eb516f75b84530a
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/plugins/projectexplorer/appoutputpane.cpp')
-rw-r--r-- | src/plugins/projectexplorer/appoutputpane.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp index c69aeaf828..2255d96b5e 100644 --- a/src/plugins/projectexplorer/appoutputpane.cpp +++ b/src/plugins/projectexplorer/appoutputpane.cpp @@ -407,10 +407,9 @@ void AppOutputPane::createNewOutputWindow(RunControl *rc) }); if (tab != m_runControlTabs.end()) { // Reuse this tab - if (tab->runControl) { - tab->runControl->setAutoDeleteOnStop(true); - tab->runControl->initiateStop(); - } + if (tab->runControl) + delete tab->runControl; + tab->runControl = rc; tab->window->reset(); rc->setupFormatter(tab->window->outputFormatter()); @@ -645,12 +644,18 @@ void AppOutputPane::closeTab(int tabIndex, CloseTabMode closeTabMode) m_tabWidget->removeTab(tabIndex); delete window; + Utils::erase(m_runControlTabs, [runControl](const RunControlTab &t) { + return t.runControl == runControl; }); if (runControl) { - runControl->setAutoDeleteOnStop(true); - runControl->initiateStop(); + if (runControl->isRunning()) { + QMetaObject::invokeMethod(runControl, [runControl] { + runControl->setAutoDeleteOnStop(true); + runControl->initiateStop(); + }, Qt::QueuedConnection); + } else { + delete runControl; + } } - Utils::erase(m_runControlTabs, [tab](const RunControlTab &t) { - return t.runControl == tab->runControl; }); updateCloseActions(); setFilteringEnabled(m_tabWidget->count() > 0); |