From 925b3cb86aeb3303d8f7f11f4a51531612334829 Mon Sep 17 00:00:00 2001 From: AlexandraTrifan Date: Fri, 20 Dec 2024 12:24:41 +0200 Subject: [PATCH] core: check if the uri already exists when adding a new device in browser. If the device was save as selected for auto-connection from a previous session but the same device is also detected during scanning, the browser will have duplicate entries of the same device, allowing us to connect to both. This should not be possible in most cases: the best example is the ADALM2000 USB connection. Signed-off-by: AlexandraTrifan --- core/src/devicemanager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/devicemanager.cpp b/core/src/devicemanager.cpp index c72981f428..b724db5561 100644 --- a/core/src/devicemanager.cpp +++ b/core/src/devicemanager.cpp @@ -67,6 +67,11 @@ void DeviceManager::addDevice(Device *d) QString DeviceManager::createDevice(QString category, QString param, bool async, QList plugins) { + for(Device *val : qAsConst(map)) { + if(val->param() == param) { + return ""; + } + } qInfo(CAT_DEVICEMANAGER) << category << "device with params" << param << "added"; Q_EMIT deviceAddStarted(param);