Fix crash in ProjectTree on restoring a session

On adding nodes to the node structure, both the FlatModel::nodesAdded
and ProjectTree::nodesAdded code is run. We need to ensure that
FlatModel::nodesAdded is run first though, as we need that information
in the ProjectTree.

Task-number: QTCREATORBUG-13667
Change-Id: I0b4b41ed6036cfdef668c16689d25611633ab0c9
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Daniel Teske
2014-12-15 18:24:25 +01:00
committed by Eike Ziller
parent beb0797008
commit 5d2d37b794
4 changed files with 61 additions and 26 deletions

View File

@@ -243,15 +243,15 @@ Node *ProjectTreeWidget::nodeForFile(const QString &fileName)
foreach (Node *node, SessionManager::nodesForFile(fileName)) {
if (!bestNode) {
bestNode = node;
bestNodeExpandCount = ProjectTreeWidget::expandedCount(node->parentFolderNode());
bestNodeExpandCount = ProjectTreeWidget::expandedCount(node);
} else if (node->nodeType() < bestNode->nodeType()) {
bestNode = node;
bestNodeExpandCount = ProjectTreeWidget::expandedCount(node->parentFolderNode());
bestNodeExpandCount = ProjectTreeWidget::expandedCount(node);
} else if (node->nodeType() == bestNode->nodeType()) {
int nodeExpandCount = ProjectTreeWidget::expandedCount(node->parentFolderNode());
int nodeExpandCount = ProjectTreeWidget::expandedCount(node);
if (nodeExpandCount < bestNodeExpandCount) {
bestNode = node;
bestNodeExpandCount = ProjectTreeWidget::expandedCount(node->parentFolderNode());
bestNodeExpandCount = ProjectTreeWidget::expandedCount(node);
}
}
}