From eb5e165deb3bccdae40c146e3d311464b7548641 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Mon, 3 Jun 2019 17:24:38 +0200 Subject: qdoc: Ensure Generator::fullDocumentLocation() returns a non-empty string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (cherry picked from commit b18d7b5b4a9bc516bea9f36e3b00084cf6f11e26) Reviewed-by: Topi Reiniƶ --- src/qdoc/generator.cpp | 7 +++++-- 1 file 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: -- cgit v1.2.3