diff --git a/src/plugins/projectexplorer/toolchainmanager.cpp b/src/plugins/projectexplorer/toolchainmanager.cpp index 1f023119b19..afcf7567b8f 100644 --- a/src/plugins/projectexplorer/toolchainmanager.cpp +++ b/src/plugins/projectexplorer/toolchainmanager.cpp @@ -213,7 +213,7 @@ void ToolChainManager::restoreToolChains() } // Then auto detect - QList detectedTcs; + QList detectedTcs = tcsToCheck; QList factories = ExtensionSystem::PluginManager::getObjects(); foreach (ToolChainFactory *f, factories) detectedTcs.append(f->autoDetect(tcsToCheck)); @@ -226,7 +226,10 @@ void ToolChainManager::restoreToolChains() // Check whether we had this TC stored and prefer the old one with the old id, marked // as auto-detection. for (int i = 0; i < tcsToCheck.count(); ++i) { - if (*(tcsToCheck.at(i)) == *currentDetected) { + if (tcsToCheck.at(i) == currentDetected) { + tcsToCheck.removeAt(i); + break; + } else if (*(tcsToCheck.at(i)) == *currentDetected) { toStore = tcsToCheck.at(i); toStore->setDetection(ToolChain::AutoDetection); tcsToCheck.removeAt(i);