Bug 458609

Summary: Solid crashes (asserts) on when first connecting Apple's Magic Mouse
Product: [Frameworks and Libraries] frameworks-solid Reporter: Ismael Asensio <isma.af>
Component: generalAssignee: Unassigned bugs mailing-list <unassigned-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal CC: christoph, kdelibs-bugs, lukas
Priority: NOR    
Version: 5.97.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Backtrace

Description Ismael Asensio 2022-09-01 18:45:45 UTC
Created attachment 151770 [details]
Backtrace

SUMMARY

When first connecting an Apple's Magic Mouse via bluetooth, plasmashell process crashes (asserts when compiled on debug mode)
Backtrace leads to Solid triggering an ASSERT on Solid::DeviceManagerPrivate::_k_deviceRemoved:
 (src/solid/devices/frontend/devicemanager.cpp:234)  Q_ASSERT(dev->backendObject() != nullptr);

Note that the magic mouse driver probably provokes some unexpected operations on UPower that triggers the assertion, where it first adds and removes a "dummy" battery device with no path, before adding the definitive one. This only happens the first time that the mouse is connected.

STEPS TO REPRODUCE
1. Run a plasma session compiled on debug mode (ideally from power-on)
2. Connect a Apple's Magic Mouse

OBSERVED RESULT
Plasmashell process crashes

SOFTWARE/OS VERSIONS
Operating System: Kubuntu 22.04
KDE Plasma Version: 5.24.80
KDE Frameworks Version: 5.98.0
Qt Version: 5.15.3
Kernel Version: 5.15.0-46-generic (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-8565U CPU @ 1.80GHz
Memory: 15.3 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 620

ADDITIONAL INFORMATION

This is the output of: 
> upower --monitor-detail /org/freedesktop/UPower/devices/mouse_hid_0coe4o41o0aobbo8b_battery

 upower --monitor-detail /org/freedesktop/UPower/devices/mouse_hid_0coe4o41o0aobbo8b_battery

Monitoring activity from the power daemon. Press Ctrl+C to cancel.

[22:47:57.526]  device added:     /org/freedesktop/UPower/devices/mouse_hid_0coe4o41o0aobbo8b_battery
  native-path:          (null)
  power supply:         no
  updated:              jue 01 ene 1970 01:00:00 (1657831677 seconds ago)
  has history:          no
  has statistics:       no
  unknown
    warning-level:       unknown
    battery-level:       unknown
    percentage:          0% (should be ignored)
    icon-name:          '(null)'

[22:47:57.526]  device removed:   /org/freedesktop/UPower/devices/mouse_hid_0coe4o41o0aobbo8b_battery

[22:47:57.564]  device added:     /org/freedesktop/UPower/devices/mouse_hid_0coe4o41o0aobbo8b_battery
  native-path:          hid-0c:e4:41:0a:bb:8b-battery
  model:                Magic Mouse 2
  power supply:         no
  updated:              jue 14 jul 2022 22:47:57 (0 seconds ago)
  has history:          yes
  has statistics:       yes
  mouse
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       none
    percentage:          50%
    icon-name:          'battery-good-symbolic'
  History (charge):
    1657831677  50,000  discharging
    1657831677  0,000   unknown
    1657831677  50,000  discharging
    1657831677  0,000   unknown
  History (rate):
    1657831677  0,000   unknown
    1657831677  0,000   unknown
Comment 1 Christoph Cullmann 2024-05-03 10:25:06 UTC

*** This bug has been marked as a duplicate of bug 464149 ***