forked from qt-creator/qt-creator
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. Amendsc1f6d70445
Amends6e16512eba
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>
This commit is contained in:
@@ -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) {
|
||||
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);
|
||||
|
||||
|
Reference in New Issue
Block a user