From 57666c2a4910b4a944f480d780bb8e6442bca4a9 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 18 Jan 2022 13:48:08 +0100 Subject: [PATCH] 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 --- src/plugins/projectexplorer/gcctoolchain.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index 5d5d4bdd926..21bd4afdc2f 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -1112,18 +1112,8 @@ Toolchains GccToolChainFactory::autoDetectToolchains( { const FilePaths compilerPaths = findCompilerCandidates(detector.device, compilerName, detectVariants == DetectVariants::Yes); - - Toolchains existingCandidates - = 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 existingCandidates = filtered(detector.alreadyKnown, + [language](const ToolChain *tc) { return tc->language() == language; }); Toolchains result; for (const FilePath &compilerPath : qAsConst(compilerPaths)) { bool alreadyExists = false; @@ -1148,8 +1138,10 @@ Toolchains GccToolChainFactory::autoDetectToolchains( == compilerPath.toFileInfo().size()); } if (existingTcMatches) { - if (!result.contains(existingTc)) + if (existingTc->typeId() == requiredTypeId && (!checker || checker(existingTc)) + && !result.contains(existingTc)) { result << existingTc; + } alreadyExists = true; } }