ProjectExplorer: Fix crash on toolchain re-detection

Fixes: QTCREATORBUG-29430
Change-Id: I8233371f70c3889ef81a3f111c298205712a2838
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2023-07-25 16:31:59 +02:00
parent ad16dba14c
commit 3c58c87585
2 changed files with 6 additions and 3 deletions

View File

@@ -10,6 +10,7 @@
#include <coreplugin/icore.h>
#include <debugger/debuggeritem.h>
#include <debugger/debuggeritemmanager.h>
#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/toolchainmanager.h>
@@ -447,7 +448,8 @@ static ToolChain *iarToolChain(const FilePath &path, Id language)
== BareMetal::Constants::IAREW_TOOLCHAIN_TYPEID;
});
if (iarFactory) {
Toolchains detected = iarFactory->autoDetect(ToolchainDetector({}, {}, {}));
Toolchains detected = iarFactory->autoDetect(
{{}, DeviceManager::defaultDesktopDevice(), {}});
if (detected.isEmpty())
detected = iarFactory->detectForImport({path, language});
for (auto tc : detected) {

View File

@@ -3,10 +3,11 @@
#include "toolchainoptionspage.h"
#include "toolchain.h"
#include "abi.h"
#include "devicesupport/devicemanager.h"
#include "projectexplorerconstants.h"
#include "projectexplorertr.h"
#include "toolchain.h"
#include "toolchainconfigwidget.h"
#include "toolchainmanager.h"
@@ -404,7 +405,7 @@ void ToolChainOptionsWidget::redetectToolchains()
QSet<ToolChain *> toDelete;
ToolChainManager::resetBadToolchains();
for (ToolChainFactory *f : ToolChainFactory::allToolChainFactories()) {
const ToolchainDetector detector(knownTcs, {}, {}); // FIXME: Pass device and search paths
const ToolchainDetector detector(knownTcs, DeviceManager::defaultDesktopDevice(), {}); // FIXME: Pass search paths
for (ToolChain * const tc : f->autoDetect(detector)) {
if (knownTcs.contains(tc) || toDelete.contains(tc))
continue;