summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordt <qtc-committer@nokia.com>2010-05-20 16:02:24 +0200
committerdt <qtc-committer@nokia.com>2010-05-20 16:16:01 +0200
commit58a5da63a8b698de6f7faae95afa9e783569353c (patch)
treed21755071b5709193aca5d9bc576a70f1b0a2a1c
parentc6ef89965943cd3b30e5cb50eed9f27ed0fad013 (diff)
downloadqt-creator-58a5da63a8b698de6f7faae95afa9e783569353c.tar.gz
Load .pro files with infinite loops
Task-Nr: QTCREATORBUG-1443
-rw-r--r--src/plugins/projectexplorer/projectnodes.cpp4
-rw-r--r--src/plugins/qt4projectmanager/qt4nodes.cpp19
2 files changed, 19 insertions, 4 deletions
diff --git a/src/plugins/projectexplorer/projectnodes.cpp b/src/plugins/projectexplorer/projectnodes.cpp
index d9cd9b11a1..04ad845036 100644
--- a/src/plugins/projectexplorer/projectnodes.cpp
+++ b/src/plugins/projectexplorer/projectnodes.cpp
@@ -313,8 +313,8 @@ void ProjectNode::addProjectNodes(const QList<ProjectNode*> &subProjects)
emit watcher->foldersAboutToBeAdded(this, folderNodes);
foreach (ProjectNode *project, subProjects) {
- QTC_ASSERT(!project->parentFolderNode(),
- qDebug("Project node has already a parent"));
+ QTC_ASSERT(!project->parentFolderNode() || project->parentFolderNode() == this,
+ qDebug("Project node has already a parent"));
project->setParentFolderNode(this);
foreach (NodesWatcher *watcher, m_watchers)
project->registerWatcher(watcher);
diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp
index 5e76e57081..9c798ef195 100644
--- a/src/plugins/qt4projectmanager/qt4nodes.cpp
+++ b/src/plugins/qt4projectmanager/qt4nodes.cpp
@@ -1177,16 +1177,31 @@ void Qt4ProFileNode::applyEvaluate(bool parseResult, bool async)
// newCumalativeIt and newExactIt are already incremented
}
- // If we found something to add do it
+ // If we found something to add, do it
if (!nodeToAdd.isEmpty()) {
ProFile *fileExact = includeFilesCumlative.value(nodeToAdd);
ProFile *fileCumlative = includeFilesCumlative.value(nodeToAdd);
- if (fileExact || fileCumlative) {
+
+ // Loop preventation, make sure that exact same node is not in our parent chain
+ bool loop = false;
+ ProjectExplorer::Node *n = this;
+ while ((n = n->parentFolderNode())) {
+ if (qobject_cast<Qt4PriFileNode *>(n) && n->path() == nodeToAdd) {
+ loop = true;
+ break;
+ }
+ }
+
+ if (loop) {
+ // Do nothing
+ } else if (fileExact || fileCumlative) {
Qt4PriFileNode *qt4PriFileNode = new Qt4PriFileNode(m_project, this, nodeToAdd);
+ qt4PriFileNode->setParentFolderNode(this); // Needed for loop detection
qt4PriFileNode->update(fileExact, m_readerExact, fileCumlative, m_readerCumulative);
toAdd << qt4PriFileNode;
} else {
Qt4ProFileNode *qt4ProFileNode = new Qt4ProFileNode(m_project, nodeToAdd);
+ qt4ProFileNode->setParentFolderNode(this); // Needed for loop detection
if (async)
qt4ProFileNode->asyncUpdate();
else