qdoc: Fix issue with findNodeForTarget()

QDoc was searching for nodes using empty target string in some
cases (when the string contained no '::' but genus was set to
either QML or CPP).

This resulted in random nodes being returned from
findUnambiguousTarget(), causing mislinking without any
warnings.

Change-Id: I1bd434ec7470580cf5cb8083c2b74c37ef562473
Reviewed-by: Martin Smith <martin.smith@digia.com>
This commit is contained in:
Topi Reinio 2015-09-04 11:55:04 +02:00 committed by Topi Reiniö
parent 9c6a49078a
commit 8a79e4d678

View File

@ -721,12 +721,8 @@ const Node* Tree::findNodeForTarget(const QStringList& path,
QString& ref) const
{
const Node* node = 0;
QString p;
if (path.size() > 1)
p = path.join(QString("::"));
else if ((genus == Node::DontCare) || (genus == Node::DOC)) {
p = path.at(0);
node = findDocumentNodeByTitle(p);
if ((genus == Node::DontCare) || (genus == Node::DOC)) {
node = findDocumentNodeByTitle(path.at(0));
if (node) {
if (!target.isEmpty()) {
ref = getRef(target, node);
@ -737,7 +733,8 @@ const Node* Tree::findNodeForTarget(const QStringList& path,
return node;
}
}
node = findUnambiguousTarget(p, ref);
node = findUnambiguousTarget(path.join(QStringLiteral("::")), ref);
if (node) {
if (!target.isEmpty()) {
ref = getRef(target, node);