summaryrefslogtreecommitdiffstats
path: root/tools/qdoc3
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2011-03-21 18:16:36 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2011-03-21 18:16:36 (GMT)
commit624368f588e555f523fc507986bf3ec80681be48 (patch)
tree9c5991a405554bacaf4d0317f51d61f87a515fdc /tools/qdoc3
parentd713d4e588543957ea4b4d9f2dc546be2b036928 (diff)
downloadQt-624368f588e555f523fc507986bf3ec80681be48.zip
Qt-624368f588e555f523fc507986bf3ec80681be48.tar.gz
Qt-624368f588e555f523fc507986bf3ec80681be48.tar.bz2
qdoc: Avoid infinite loops in table of contents generation.
Diffstat (limited to 'tools/qdoc3')
-rw-r--r--tools/qdoc3/helpprojectwriter.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/qdoc3/helpprojectwriter.cpp b/tools/qdoc3/helpprojectwriter.cpp
index 949507f..1c7fcbf 100644
--- a/tools/qdoc3/helpprojectwriter.cpp
+++ b/tools/qdoc3/helpprojectwriter.cpp
@@ -702,6 +702,8 @@ void HelpProjectWriter::generateProject(HelpProject &project)
}
} else {
// Find a contents node and navigate from there, using the NextLink values.
+ QSet<QString> visited;
+
foreach (const Node *node, subproject.nodes) {
QString nextTitle = node->links().value(Node::NextLink).first;
if (!nextTitle.isEmpty() &&
@@ -715,9 +717,10 @@ void HelpProjectWriter::generateProject(HelpProject &project)
while (nextPage) {
writeNode(project, writer, nextPage);
nextTitle = nextPage->links().value(Node::NextLink).first;
- if(nextTitle.isEmpty())
+ if (nextTitle.isEmpty() || visited.contains(nextTitle))
break;
nextPage = const_cast<FakeNode *>(tree->findFakeNodeByTitle(nextTitle));
+ visited.insert(nextTitle);
}
break;
}