make sure Solid::Battery is not deleted from QML
ClosedPublic

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

Details

Summary

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
pointers.

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

Repository
R102 KInfoCenter
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
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.