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

Harald Sitter noreply at phabricator.kde.org
Fri Jan 17 12:17:54 GMT 2020


sitter created this revision.
sitter added a reviewer: broulik.
Herald added a project: Plasma.
Herald added a subscriber: plasma-devel.
sitter requested review of this revision.

REVISION 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

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

REPOSITORY
  R102 KInfoCenter

BRANCH
  413003

REVISION DETAIL
  https://phabricator.kde.org/D26725

AFFECTED FILES
  Modules/energy/batterymodel.cpp

To: sitter, broulik
Cc: 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20200117/fbbdede3/attachment.html>


More information about the Plasma-devel mailing list