forked from qt-creator/qt-creator
Fix crash on closing Creator
Removing a target setup widget might lead to removing a kit, due to some kits being temporary for importers. A kit removal then would lead to a target removal and this would make the code recurse into the widget cache. Fix that by ensuring that we disconnect from the project first in ProjectWindow::deregisterProject. And also remove the clearing of the project window, instead simply clear the widget cache as each project is closed. Change-Id: I278c43ef4ba77217428c5c36f0a07d0d96cb3022 Task-number: QTCREATORBUG-14694 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
This commit is contained in:
@@ -96,11 +96,7 @@ ProjectWindow::~ProjectWindow()
|
||||
|
||||
void ProjectWindow::aboutToShutdown()
|
||||
{
|
||||
showProperties(-1, -1); // that's a bit stupid, but otherwise stuff is still
|
||||
// connected to the session
|
||||
m_cache.clear();
|
||||
disconnect(KitManager::instance(), 0, this, 0);
|
||||
disconnect(SessionManager::instance(), 0, this, 0);
|
||||
showProperties(-1, -1);
|
||||
}
|
||||
|
||||
void ProjectWindow::removedTarget(Target *)
|
||||
@@ -179,13 +175,14 @@ bool ProjectWindow::deregisterProject(Project *project)
|
||||
if (index == -1)
|
||||
return false;
|
||||
|
||||
disconnect(project, SIGNAL(removedTarget(ProjectExplorer::Target*)),
|
||||
this, SLOT(removedTarget(ProjectExplorer::Target*)));
|
||||
|
||||
QVector<QWidget *> deletedWidgets = m_cache.deregisterProject(project);
|
||||
if (deletedWidgets.contains(m_currentWidget))
|
||||
m_currentWidget = 0;
|
||||
|
||||
m_tabWidget->removeTab(index);
|
||||
disconnect(project, SIGNAL(removedTarget(ProjectExplorer::Target*)),
|
||||
this, SLOT(removedTarget(ProjectExplorer::Target*)));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -383,8 +380,3 @@ int WidgetCache::recheckFactories(Project *project, int oldSupportsIndex)
|
||||
return newIndex;
|
||||
}
|
||||
|
||||
void WidgetCache::clear()
|
||||
{
|
||||
while (!m_projects.isEmpty())
|
||||
deregisterProject(m_projects.first().project);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user