diff --git a/src/plugins/perfprofiler/perftracepointdialog.cpp b/src/plugins/perfprofiler/perftracepointdialog.cpp index c6ca317d913..771471b186f 100644 --- a/src/plugins/perfprofiler/perftracepointdialog.cpp +++ b/src/plugins/perfprofiler/perftracepointdialog.cpp @@ -63,10 +63,8 @@ PerfTracePointDialog::PerfTracePointDialog() : } if (!m_device) { - const DeviceManager *deviceManager = DeviceManager::instance(); - // There should at least be a desktop device. - m_device = deviceManager->defaultDevice(Constants::DESKTOP_DEVICE_TYPE); + m_device = DeviceManager::defaultDesktopDevice(); QTC_ASSERT(m_device, return); } diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp index 1c8b125b578..b59113d25f6 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp @@ -104,7 +104,7 @@ Runnable CustomExecutableRunConfiguration::runnable() const r.setCommandLine(commandLine()); r.environment = aspect()->environment(); r.workingDirectory = workingDirectory.toString(); - r.device = DeviceManager::instance()->defaultDevice(Constants::DESKTOP_DEVICE_TYPE); + r.device = DeviceManager::defaultDesktopDevice(); if (!r.executable.isEmpty()) { const QString expanded = macroExpander()->expand(r.executable.toString()); diff --git a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp index 532240b1331..97c700eb2b5 100644 --- a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp @@ -331,6 +331,11 @@ IDevice::ConstPtr DeviceManager::deviceForPath(const FilePath &path) return {}; } +IDevice::ConstPtr DeviceManager::defaultDesktopDevice() +{ + return m_instance->defaultDevice(Constants::DESKTOP_DEVICE_TYPE); +} + void DeviceManager::setDefaultDevice(Utils::Id id) { QTC_ASSERT(this != instance(), return); diff --git a/src/plugins/projectexplorer/devicesupport/devicemanager.h b/src/plugins/projectexplorer/devicesupport/devicemanager.h index ef8047e0a57..466adb36b9b 100644 --- a/src/plugins/projectexplorer/devicesupport/devicemanager.h +++ b/src/plugins/projectexplorer/devicesupport/devicemanager.h @@ -69,7 +69,9 @@ public: void setDeviceState(Utils::Id deviceId, IDevice::DeviceState deviceState); bool isLoaded() const; + static IDevice::ConstPtr deviceForPath(const Utils::FilePath &path); + static IDevice::ConstPtr defaultDesktopDevice(); signals: void deviceAdded(Utils::Id id); diff --git a/src/plugins/projectexplorer/kitinformation.cpp b/src/plugins/projectexplorer/kitinformation.cpp index f6f651b8688..2b1fd0d711b 100644 --- a/src/plugins/projectexplorer/kitinformation.cpp +++ b/src/plugins/projectexplorer/kitinformation.cpp @@ -1231,8 +1231,7 @@ BuildDeviceKitAspect::BuildDeviceKitAspect() QVariant BuildDeviceKitAspect::defaultValue(const Kit *k) const { Q_UNUSED(k); - IDevice::ConstPtr defaultDevice = - DeviceManager::instance()->defaultDevice(Constants::DESKTOP_DEVICE_TYPE); + IDevice::ConstPtr defaultDevice = DeviceManager::defaultDesktopDevice(); return defaultDevice->id().toString(); }