<table><tr><td style="">sitter created this revision.<br />sitter added a reviewer: broulik.<br />Herald added a project: Plasma.<br />Herald added a subscriber: plasma-devel.<br />sitter requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D26725">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>Battery objects are casted DeviceInterface objects and those are<br />
owned by Solid. deleting them outside solid means they will end<br />
up as dangling pointers inside Solid's global static objects.</p>

<p>when switching away from the energy KCM the qml engine would<br />
get cleaned up as part of the KCM destruction, qml would then<br />
sweep up the Battery object and corrupt the solid internal<br />
pointers.</p>

<p>to prevent this, explicitly mark Battery objects we give to QML<br />
as owned on the c++ side.</p>

<p>BUG: 413003</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>open kinfocenter<br />
switch to energy<br />
switch away<br />
switch to energy<br />
no crash</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R102 KInfoCenter</div></div></div><br /><div><strong>BRANCH</strong><div><div>413003</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D26725">https://phabricator.kde.org/D26725</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>Modules/energy/batterymodel.cpp</div></div></div><br /><div><strong>To: </strong>sitter, broulik<br /><strong>Cc: </strong>plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, zachus, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart<br /></div>