aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/projectexplorer/projecttree.cpp
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2017-08-29 14:32:10 +0200
committerTobias Hunger <tobias.hunger@qt.io>2017-09-01 14:42:34 +0000
commit60b8712a4283be7dfdfe7d566c57a5ea85ff3be0 (patch)
treeda563cc37f187dd21643a0a3f6be2e3b048f416c /src/plugins/projectexplorer/projecttree.cpp
parent1bcde48da917a8a34173088aa104ad669e14a17d (diff)
Wizards: Do not crash when adding files to existing projectv4.4.0
Do not crash when adding a file to an existing project that finishes parsing while the wizard is still open. Make sure the Node that is passed into the wizard is still valid after parsing. Provide more information to the wizard so that this can be checked -- and to find the similar node in the new project tree. Also avoid a crash when adding existing files. Do not crash when project parsing finishes while the wizard summary page is open. Do not crash when the project gets closed while the summary page is open. Do not have the ProjectTree send signals about subTreeChanges if the node that changed is not part of the ProjectTree. This avoids an infinite loop when updating the combobox on the summary page. Add a treeChanged signal to ProjectTree. Task-number: QTCREATORBUG-18651 Change-Id: Iaed3d0d1f079c09e54389821a11bda596139f35c Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/projecttree.cpp')
-rw-r--r--src/plugins/projectexplorer/projecttree.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/plugins/projectexplorer/projecttree.cpp b/src/plugins/projectexplorer/projecttree.cpp
index 50b8b65256..fcaf5d8178 100644
--- a/src/plugins/projectexplorer/projecttree.cpp
+++ b/src/plugins/projectexplorer/projecttree.cpp
@@ -72,10 +72,15 @@ ProjectTree::ProjectTree(QObject *parent) : QObject(parent)
connect(SessionManager::instance(), &SessionManager::projectAdded,
this, &ProjectTree::sessionChanged);
+ connect(SessionManager::instance(), &SessionManager::projectAdded,
+ this, &ProjectTree::treeChanged);
connect(SessionManager::instance(), &SessionManager::projectRemoved,
this, &ProjectTree::sessionChanged);
+ connect(SessionManager::instance(), &SessionManager::projectRemoved,
+ this, &ProjectTree::treeChanged);
connect(SessionManager::instance(), &SessionManager::startupProjectChanged,
this, &ProjectTree::sessionChanged);
+ connect(this, &ProjectTree::subtreeChanged, this, &ProjectTree::treeChanged);
}
ProjectTree::~ProjectTree()
@@ -261,7 +266,8 @@ void ProjectTree::updateContext()
void ProjectTree::emitSubtreeChanged(FolderNode *node)
{
- emit s_instance->subtreeChanged(node);
+ if (hasNode(node))
+ emit s_instance->subtreeChanged(node);
}
void ProjectTree::collapseAll()
@@ -377,6 +383,13 @@ void ProjectTree::applyTreeManager(FolderNode *folder)
f(folder);
}
+bool ProjectTree::hasNode(const Node *node)
+{
+ return Utils::contains(SessionManager::projects(), [node](const Project *p) {
+ return p && p->rootProjectNode() && p->rootProjectNode()->findNode([node](const Node *n) { return n == node; });
+ });
+}
+
void ProjectTree::hideContextMenu()
{
m_focusForContextMenu = nullptr;