ProjectExplorer: Let toolchains be (de)registered in bulk

When some code adds or removes a bunch of toolchains at once, that
should be made explicit and also be reflected by the respective signal
emissions.
Fix some leaks and typos along the way.

Change-Id: I4a1f12a2378316c5faf70e85a88adc467f076caf
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2024-07-18 11:10:24 +02:00
parent eb6c95b50d
commit 9d0c144892
13 changed files with 198 additions and 169 deletions

View File

@@ -787,14 +787,16 @@ void AsyncToolchainDetector::run()
[watcher,
alreadyRegistered = m_alreadyRegistered]() {
Toolchains existingTcs = ToolchainManager::toolchains();
Toolchains toRegister;
for (Toolchain *tc : watcher->result()) {
if (tc->isValid() && !alreadyRegistered(tc, existingTcs)) {
ToolchainManager::registerToolchain(tc);
toRegister << tc;
existingTcs << tc;
} else {
delete tc;
}
}
ToolchainManager::registerToolchains(toRegister);
watcher->deleteLater();
});
watcher->setFuture(Utils::asyncRun(m_func, m_detector));