Commit c47eb9ba authored by David Redondo's avatar David Redondo 🏎
Browse files

Delete Clients in KsysGuardDaemon destructor

Clients and plugins are both children of the daemon. The Client destructor
dereferences SensorProperties to unsubscribe from them. Because usually
the object tree looks something like plugin -> sensorcontainer -> sensorobject -> sensorproperty
we can not rely on the properties still being around when the clients are deleted.
This fixes the segfault in the unit test detected by the address sanitizer.
parent 902cf6b2
......@@ -60,6 +60,13 @@ KSysGuardDaemon::KSysGuardDaemon()
timer->start();
}
KSysGuardDaemon::~KSysGuardDaemon()
{
for (Client* c : m_clients) {
delete c;
}
}
void KSysGuardDaemon::init()
{
loadProviders();
......
......@@ -38,6 +38,7 @@ class KSysGuardDaemon : public QObject, public QDBusContext
public:
KSysGuardDaemon();
~KSysGuardDaemon();
void init();
SensorProperty *findSensor(const QString &path) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment