make sure Solid::Battery is not deleted from QML

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

Description

make sure Solid::Battery is not deleted from QML

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

Reviewers: broulik, davidedmundson

Reviewed By: davidedmundson

Subscribers: plasma-devel

Tags: Plasma

Differential Revision: https://phabricator.kde.org/D26725

Details

Committed
sitterJan 17 2020, 1:30 PM
Reviewer
davidedmundson
Differential Revision
D26725: make sure Solid::Battery is not deleted from QML
Parents
R102:b18b198854c1: Update version number for 5.17.90 GIT_SILENT
Branches
Unknown
Tags
Unknown