summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2017-03-24 11:06:26 +0100
committerTobias Hunger <tobias.hunger@qt.io>2017-03-24 11:16:19 +0000
commitb021660c1e6e00f5034439b6eaa143742c4d4007 (patch)
tree89816bfb2aaaf8634a9552b1d6052256f3f9704d
parent3492da12468f10a5ec83a102b7aba9043b46f4dc (diff)
downloadqt-creator-b021660c1e6e00f5034439b6eaa143742c4d4007.tar.gz
ProjectExplorer: Treat empty root project nodes better
Do not set up empty root project nodes and fall back to the default project tree instead. A project can not ever be empty: It should at least include the project file itself so that the user can fix breakages when project parsing fails. Change-Id: I692e299f56727305120777cdc532607d5b0be99e Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
-rw-r--r--src/plugins/projectexplorer/project.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp
index e8b68a4560..6b092b676a 100644
--- a/src/plugins/projectexplorer/project.cpp
+++ b/src/plugins/projectexplorer/project.cpp
@@ -461,6 +461,14 @@ void Project::setRootProjectNode(ProjectNode *root)
if (d->m_rootProjectNode == root)
return;
+ if (root && root->nodes().isEmpty()) {
+ // Something went wrong with parsing: At least the project file needs to be
+ // shown so that the user can fix the breakage.
+ // Do not leak root and use default project tree in this case.
+ delete root;
+ root = nullptr;
+ }
+
ProjectTree::applyTreeManager(root);
ProjectNode *oldNode = d->m_rootProjectNode;