forked from qt-creator/qt-creator
ProjectExplorer: Remove duplicate devices
In rare cases it can happen that the installer creates a device that happens to have the same rootPath as a user created device. We need to filter these out since otherwise it can be random which of the two devices is selected. Change-Id: I8269795a2e4f439fb2f02d819272723a504c6703 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -174,7 +174,7 @@ void DeviceManager::load()
|
|||||||
// devices with the same id.
|
// devices with the same id.
|
||||||
for (IDevice::ConstPtr device : std::as_const(userDevices)) {
|
for (IDevice::ConstPtr device : std::as_const(userDevices)) {
|
||||||
for (const IDevice::Ptr &sdkDevice : std::as_const(sdkDevices)) {
|
for (const IDevice::Ptr &sdkDevice : std::as_const(sdkDevices)) {
|
||||||
if (device->id() == sdkDevice->id()) {
|
if (device->id() == sdkDevice->id() || device->rootPath() == sdkDevice->rootPath()) {
|
||||||
if (device->version() < sdkDevice->version())
|
if (device->version() < sdkDevice->version())
|
||||||
device = sdkDevice;
|
device = sdkDevice;
|
||||||
sdkDevices.removeOne(sdkDevice);
|
sdkDevices.removeOne(sdkDevice);
|
||||||
|
|||||||
Reference in New Issue
Block a user