diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-22 22:08:46 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-22 22:08:46 +1000 |
| commit | f9fa8390137e93da8c9b93271e7ce85dfed55b7f (patch) | |
| tree | 3de5488479524c86231d0d06a67edfcc583e13e4 /plugin/src/Caelestia/Services/service.hpp | |
| parent | plugin: delete entries after emitting signal (diff) | |
| download | caelestia-shell-f9fa8390137e93da8c9b93271e7ce85dfed55b7f.tar.gz caelestia-shell-f9fa8390137e93da8c9b93271e7ce85dfed55b7f.tar.bz2 caelestia-shell-f9fa8390137e93da8c9b93271e7ce85dfed55b7f.zip | |
plugin/service: ref by object
Use QSet and auto unref on sender destruction
Diffstat (limited to 'plugin/src/Caelestia/Services/service.hpp')
| -rw-r--r-- | plugin/src/Caelestia/Services/service.hpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/plugin/src/Caelestia/Services/service.hpp b/plugin/src/Caelestia/Services/service.hpp index 7980bdd..dac48760 100644 --- a/plugin/src/Caelestia/Services/service.hpp +++ b/plugin/src/Caelestia/Services/service.hpp @@ -1,28 +1,21 @@ #pragma once -#include <qmutex.h> #include <qobject.h> +#include <qset.h> namespace caelestia { class Service : public QObject { Q_OBJECT - Q_PROPERTY(int refCount READ refCount NOTIFY refCountChanged) - public: explicit Service(QObject* parent = nullptr); - [[nodiscard]] int refCount() const; - - void ref(); - void unref(); - -signals: - void refCountChanged(); + void ref(QObject* sender); + void unref(QObject* sender); private: - int m_refCount; + QSet<QObject*> m_refs; virtual void start() = 0; virtual void stop() = 0; |