Bug 416495

Summary: Device::allDevices keeps growing in size with udisks2
Product: [Frameworks and Libraries] frameworks-solid Reporter: Harald Sitter <sitter>
Component: generalAssignee: Lukáš Tinkl <lukas>
Status: RESOLVED FIXED    
Severity: normal CC: kde, kdelibs-bugs, meven.car
Priority: NOR    
Version: 5.66.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.73
Sentry Crash Report:
Attachments: example app

Description Harald Sitter 2020-01-20 12:00:06 UTC
Created attachment 125260 [details]
example app

listen to deviceAdded and deviceRemoved, run Solid::Device::allDevices().count() each time

STEPS TO REPRODUCE
1. see example code
2. run
3. attach thumb drive
4. remove
5. add
6. remove

OBSERVED RESULT
see overall device count of Device::allDevices go up and up and up. it looks to me that all disk devices simply get duplicated each time. this ultimately results in at least part of the defect described in bug #399746 where kinfocenter will display garbage entries. this is because kinfocenter listens to the notifications but then always runs through the entire allDevices list to inject new devices into the treeview, as such each time devices get duplicated the list in kinfocenter grows.

EXPECTED RESULT
device count doesn't keep growing

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.17.5
KDE Frameworks Version: 5.66.0
Qt Version: 5.13.2
Kernel Version: 5.5.0-050500rc5-generic
OS Type: 64-bit
Processors: 12 × AMD Ryzen 5 3600X 6-Core Processor
Memory: 15,6 GiB of RAM
Comment 1 Bug Janitor Service 2020-07-29 14:47:51 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/solid/-/merge_requests/11