forked from qt-creator/qt-creator
ProjectExplorer: Fix unsafe kit removal procedure
We iterated through a list that was in the middle of a std::remove(), which is not safe. Change-Id: I2b4bce18ebe3365fd22f33521aa82868c10e9647 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -238,12 +238,15 @@ void KitManager::restoreKits()
|
||||
kitsToCheck.clear();
|
||||
|
||||
// Remove replacement kits for which the original kit has turned up again.
|
||||
Utils::erase(resultList, [&resultList](const std::unique_ptr<Kit> &k) {
|
||||
return k->isReplacementKit()
|
||||
&& contains(resultList, [&k](const std::unique_ptr<Kit> &other) {
|
||||
return other->id() == k->id() && other != k;
|
||||
});
|
||||
});
|
||||
for (auto it = resultList.begin(); it != resultList.end();) {
|
||||
const auto &k = *it;
|
||||
if (k->isReplacementKit() && contains(resultList, [&k](const std::unique_ptr<Kit> &other) {
|
||||
return other->id() == k->id() && other != k; })) {
|
||||
it = resultList.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
static const auto kitMatchesAbiList = [](const Kit *kit, const Abis &abis) {
|
||||
const QList<ToolChain *> toolchains = ToolChainKitAspect::toolChains(kit);
|
||||
|
Reference in New Issue
Block a user