ProjectExplorer: Fix spurious GCC execution on start-up

The mingw and gcc factories share some file name candidates.
Make sure we don't test a known gcc executable again for mingw (and vice
versa).

Change-Id: Iddbf1a0c435f6515ff07fca695cb55211faab28e
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2022-01-18 13:48:08 +01:00
parent 31807ab917
commit 57666c2a49

View File

@@ -1112,18 +1112,8 @@ Toolchains GccToolChainFactory::autoDetectToolchains(
{ {
const FilePaths compilerPaths = const FilePaths compilerPaths =
findCompilerCandidates(detector.device, compilerName, detectVariants == DetectVariants::Yes); findCompilerCandidates(detector.device, compilerName, detectVariants == DetectVariants::Yes);
Toolchains existingCandidates = filtered(detector.alreadyKnown,
Toolchains existingCandidates [language](const ToolChain *tc) { return tc->language() == language; });
= filtered(detector.alreadyKnown, [requiredTypeId, language, &checker](const ToolChain *tc) {
if (tc->typeId() != requiredTypeId)
return false;
if (tc->language() != language)
return false;
if (checker && !checker(tc))
return false;
return true;
});
Toolchains result; Toolchains result;
for (const FilePath &compilerPath : qAsConst(compilerPaths)) { for (const FilePath &compilerPath : qAsConst(compilerPaths)) {
bool alreadyExists = false; bool alreadyExists = false;
@@ -1148,8 +1138,10 @@ Toolchains GccToolChainFactory::autoDetectToolchains(
== compilerPath.toFileInfo().size()); == compilerPath.toFileInfo().size());
} }
if (existingTcMatches) { if (existingTcMatches) {
if (!result.contains(existingTc)) if (existingTc->typeId() == requiredTypeId && (!checker || checker(existingTc))
&& !result.contains(existingTc)) {
result << existingTc; result << existingTc;
}
alreadyExists = true; alreadyExists = true;
} }
} }