Files
z-bar-qt/Plugins/ZShell/Services/service.cpp
AramJonghu 467e44bb9f
C++ / build (pull_request) Failing after 15s
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 28s
Python / lint-format (pull_request) Successful in 45s
Python / test (pull_request) Successful in 38s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m45s
tidy&format(all): all files formatted and relevant warnings resolved
2026-06-30 02:04:24 +02:00

26 lines
460 B
C++

#include "service.hpp"
#include <qdebug.h>
#include <qpointer.h>
namespace ZShell::services {
Service::Service(QObject* parent) : QObject(parent) {}
void Service::ref(QObject* sender) {
if (m_refs.isEmpty()) {
start();
}
QObject::connect(sender, &QObject::destroyed, this, &Service::unref);
m_refs << sender;
}
void Service::unref(QObject* sender) {
if (m_refs.remove(sender) && m_refs.isEmpty()) {
stop();
}
}
} // namespace ZShell::services