File: upstream_a83c4e5f_applets-devicenotifier-check-if-device-has-been-added-before.patch

package info (click to toggle)
plasma-workspace 4%3A6.3.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 104,900 kB
  • sloc: cpp: 125,434; xml: 31,579; python: 3,976; perl: 572; sh: 234; javascript: 74; ruby: 39; ansic: 13; makefile: 9
file content (32 lines) | stat: -rw-r--r-- 1,166 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From a83c4e5f4139c47a8b36e94c75891e02739d8bde Mon Sep 17 00:00:00 2001
From: Bohdan Onofriichuk <bogdan.onofriuchuk@gmail.com>
Date: Mon, 5 May 2025 19:13:54 +0000
Subject: [PATCH] applets/devicenotifier: check if device has been added before

BUG: 495140

Skip device if applet already has device with similar udi
---
 applets/devicenotifier/plugin/devicecontrol.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/applets/devicenotifier/plugin/devicecontrol.cpp b/applets/devicenotifier/plugin/devicecontrol.cpp
index 4c76b3e1d5..bfe65ff0bf 100644
--- a/applets/devicenotifier/plugin/devicecontrol.cpp
+++ b/applets/devicenotifier/plugin/devicecontrol.cpp
@@ -152,6 +152,12 @@ QHash<int, QByteArray> DeviceControl::roleNames() const
 void DeviceControl::onDeviceAdded(const QString &udi)
 {
     qCDebug(APPLETS::DEVICENOTIFIER) << "Device Controller: Added device signal arrived : " << udi;
+
+    if (m_actions.contains(udi)) {
+        qCDebug(APPLETS::DEVICENOTIFIER) << "Device Controller: Device already exists. Don't add another one : " << udi;
+        return;
+    }
+
     Solid::Device device(udi);
 
     if (!device.isValid()) {
-- 
GitLab