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/e7 |ma/libksysguard/-/commit/41
                   |2f83052f8a8191239831125c75b |4335eb82366a7c242ef06257fb0
                   |d0e59d004c8                 |0e9b631a2da

--- Comment #4 from Nate Graham <[email protected]> ---
Git commit 414335eb82366a7c242ef06257fb00e9b631a2da by Nate Graham.
Committed on 30/07/2026 at 14:09.
Pushed by ngraham into branch 'Plasma/6.7'.

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/414335eb82366a7c242ef06257fb00e9b631a2da

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to