From 4d95e930bc7a48ea3605671bb1f92bf216e1b6b0 Mon Sep 17 00:00:00 2001 From: APTX Date: Sun, 2 Nov 2014 17:46:56 +0100 Subject: [PATCH] Just set the state in the destructor and assume the service manages to cleanup on it's own. stop/deinitialize call virtual functions which does not work in destructors. Another option would be to require services to call some "destroy" method in their own destructor. --- localmylist/service.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/localmylist/service.cpp b/localmylist/service.cpp index 0d675fd..308ef6a 100644 --- a/localmylist/service.cpp +++ b/localmylist/service.cpp @@ -12,8 +12,10 @@ Service::Service(const QString &name, QObject *parent) : Service::~Service() { - stop(); - deinitialize(); + if (m_state == Running) + setState(Stopped); + if (m_state == Stopped) + setState(Uninitialized); } Service::ServiceState Service::state() const -- 2.52.0