make sure Solid::Battery is not deleted from QML

Authored by sitter on Jan 17 2020, 12:17 PM.



Battery objects are casted DeviceInterface objects and those are
owned by Solid. deleting them outside solid means they will end
up as dangling pointers inside Solid's global static objects.

when switching away from the energy KCM the qml engine would
get cleaned up as part of the KCM destruction, qml would then
sweep up the Battery object and corrupt the solid internal

to prevent this, explicitly mark Battery objects we give to QML
as owned on the c++ side.

BUG: 413003
FIXED-IN: 5.18.0

Test Plan

open kinfocenter
switch to energy
switch away
switch to energy
no crash

Diff Detail

R102 KInfoCenter
No Linters Available
No Unit Test Coverage
Build Status
Buildable 21269
Build 21287: arc lint + arc unit
sitter created this revision.Jan 17 2020, 12:17 PM
Restricted Application added a project: Plasma. · View Herald TranscriptJan 17 2020, 12:17 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
sitter requested review of this revision.Jan 17 2020, 12:17 PM
davidedmundson accepted this revision.Jan 17 2020, 12:19 PM
This revision is now accepted and ready to land.Jan 17 2020, 12:19 PM
sitter edited the summary of this revision. (Show Details)Jan 17 2020, 1:29 PM
This revision was automatically updated to reflect the committed changes.