summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2019-06-03 17:24:38 +0200
committerTopi Reinio <topi.reinio@qt.io>2019-06-03 17:35:26 +0200
commitb18d7b5b4a9bc516bea9f36e3b00084cf6f11e26 (patch)
tree0d9038382c102db08539bb48e1b6c3a1f75205e0
parente33ac6f1b1ebb882684f24f7d026267584d9393a (diff)
downloadqttools-b18d7b5b4a9bc516bea9f36e3b00084cf6f11e26.tar.gz
qdoc: Ensure Generator::fullDocumentLocation() returns a non-empty string
The function took the parent node's location without checking whether the parent is the root namespace. For example nodes (and possibly others), this meant that we got an empty location. This in turn resulted in QDoc omitting the 'href' attribute when writing an .index node entry for an example node, and consequently, linking failures. Fixes: QTBUG-76171 Change-Id: I984ada1b88468aab71d08ba7d102bd8661304dab Reviewed-by: Martin Smith <martin.smith@qt.io>
-rw-r--r--src/qdoc/generator.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/qdoc/generator.cpp b/src/qdoc/generator.cpp
index ac6577c81..71da36e3c 100644
--- a/src/qdoc/generator.cpp
+++ b/src/qdoc/generator.cpp
@@ -600,8 +600,11 @@ QString Generator::fullDocumentLocation(const Node *node, bool useSubdir)
Node *parentNode = nullptr;
- if ((parentNode = node->parent()))
- parentName = fullDocumentLocation(node->parent());
+ if ((parentNode = node->parent())) {
+ // use the parent's name unless the parent is the root namespace
+ if (!node->parent()->isNamespace() || !node->parent()->name().isEmpty())
+ parentName = fullDocumentLocation(node->parent());
+ }
switch (node->nodeType()) {
case Node::Class: