From 8875c59021586bf66b38299873dd05f440a99665 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 4 Feb 2021 09:28:14 +0100 Subject: [PATCH] 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 6d97c1fcb1f0a8c712d902065a887f8b74c61cf4 Fixes: QTCREATORBUG-25310 Change-Id: I75db6f8783b5f62aa9805b69d4d2bba07b906a5b Reviewed-by: David Schulz --- src/plugins/coreplugin/mainwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 6fb5e170ddd..aececbbb2d3 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -1016,6 +1016,8 @@ void MainWindow::updateContextObject(const QList &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(); }