diff options
author | Topi Reinio <topi.reinio@qt.io> | 2019-06-03 17:24:38 +0200 |
---|---|---|
committer | Topi Reiniƶ <topi.reinio@qt.io> | 2019-06-04 15:12:35 +0000 |
commit | eb5e165deb3bccdae40c146e3d311464b7548641 (patch) | |
tree | 7090de45a0f9fa0ee0e4aed184813274907caf0c | |
parent | 50a172f8ad2891fe2e00e3d2ccd4f4536a73f9e4 (diff) |
qdoc: Ensure Generator::fullDocumentLocation() returns a non-empty stringv5.13.0-rc2
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>
(cherry picked from commit b18d7b5b4a9bc516bea9f36e3b00084cf6f11e26)
Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
-rw-r--r-- | src/qdoc/generator.cpp | 7 |
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: |