[ksystemstats] [Bug 523562] ksystemstats inadvertent crashes

"Nate Graham" <[email protected]>
Newsgroups gmane.comp.kde.devel.bugs
Message-ID <[email protected]/>
https://bugs.kde.org/show_bug.cgi?id=523562

Nate Graham <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Latest Commit|https://invent.kde.org/plas |https://invent.kde.org/plas
                   |ma/libksysguard/-/commit/41 |ma/libksysguard/-/commit/34
                   |4335eb82366a7c242ef06257fb0 |5dfa2b9cdd91806108f8ee77483
                   |0e9b631a2da                 |d1d785d7214

--- Comment #5 from Nate Graham <[email protected]> ---
Git commit 345dfa2b9cdd91806108f8ee77483d1d785d7214 by Nate Graham.
Committed on 30/07/2026 at 14:19.
Pushed by ngraham into branch 'Plasma/6.6'.

systemstats: don't keep dangling SensorObject pointers in SensorContainer

A SensorObject was only removed from its SensorContainer when it emitted
aboutToBeRemoved; the destructor did neither that nor any deregistration. An
object deleted by any other route (directly, or by its QObject parent)
therefore
left a dangling raw pointer in the container. When another object was later
added,
objectAdded triggered AggregateSensor::updateSensors(), which iterates
objects()
and calls id() on each, dereferencing the freed object and crashing in the
QString copy.

Connect each object's QObject::destroyed to drop it from the container,
comparing
by identity so re-adding an object with the same id is unaffected. Also
register
objects with the object itself as the queued-call context, so an object
destroyed
before its queued addObject() runs no longer calls addObject() on a dangling
pointer.


(cherry picked from commit e72f83052f8a8191239831125c75bd0e59d004c8)

Co-authored-by: Méven Car <[email protected]>

M  +1    -0    autotests/CMakeLists.txt
A  +85   -0    autotests/sensorcontainertest.cpp     [License: LGPL(v2.0+)]
M  +6    -0    systemstats/SensorContainer.cpp
M  +1    -1    systemstats/SensorObject.cpp

https://invent.kde.org/plasma/libksysguard/-/commit/345dfa2b9cdd91806108f8ee77483d1d785d7214

-- 
You are receiving this mail because:
You are watching all bug changes.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.