From 890a7c616a0348180f294bf2d611e1fa49437600 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 18 Mar 2019 16:45:26 +0100 Subject: [PATCH] FileInProjectFinder: Do not overwrite result list in loop Change-Id: Idadb7fcc43f816ea202b620472144392dd1e338e Reviewed-by: Christian Kandeler Reviewed-by: hjk --- src/libs/utils/fileinprojectfinder.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/utils/fileinprojectfinder.cpp b/src/libs/utils/fileinprojectfinder.cpp index 054e5d9c3b4..b187c3b92d0 100644 --- a/src/libs/utils/fileinprojectfinder.cpp +++ b/src/libs/utils/fileinprojectfinder.cpp @@ -464,20 +464,20 @@ FileInProjectFinder::PathMappingNode::~PathMappingNode() FileNameList FileInProjectFinder::QrcUrlFinder::find(const QUrl &fileUrl) const { - FileNameList result; const auto fileIt = m_fileCache.constFind(fileUrl); if (fileIt != m_fileCache.cend()) return fileIt.value(); + QStringList hits; for (const FileName &f : m_allQrcFiles) { QrcParser::Ptr &qrcParser = m_parserCache[f]; if (!qrcParser) qrcParser = QrcParser::parseQrcFile(f.toString(), QString()); if (!qrcParser->isValid()) continue; - QStringList hits; qrcParser->collectFilesAtPath(QrcParser::normalizedQrcFilePath(fileUrl.toString()), &hits); - result = transform(hits, [](const QString &fp) { return FileName::fromString(fp); }); } + hits.removeDuplicates(); + const FileNameList result = transform(hits, &FileName::fromString); m_fileCache.insert(fileUrl, result); return result; }