Core: Do not remove context objects during shutdown

Like we suppress context updates during shutdown also disconnect from
the context object's destroyed signal. At that point we don't care
anymore.

This also avoids issues if the context object lives as the child of a
widget in the MainWindow geometry. These widgets (and respectively their
children) are destroyed only in the QObject destructor, i.e. after the
MainWindow itself already destroyed all its members, including the
m_contextWidgets map.

Amends 6d97c1fcb1

Fixes: QTCREATORBUG-25310
Change-Id: I75db6f8783b5f62aa9805b69d4d2bba07b906a5b
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Eike Ziller
2021-02-04 09:28:14 +01:00
parent c25afb1b59
commit 8875c59021

View File

@@ -1016,6 +1016,8 @@ void MainWindow::updateContextObject(const QList<IContext *> &context)
void MainWindow::aboutToShutdown()
{
disconnect(qApp, &QApplication::focusChanged, this, &MainWindow::updateFocusWidget);
for (auto contextPair : m_contextWidgets)
disconnect(contextPair.second, &QObject::destroyed, this, nullptr);
m_activeContext.clear();
hide();
}