]> Some of my projects - localmylist.git/commitdiff
Just set the state in the destructor and assume the service manages to cleanup on...
authorAPTX <marek321@gmail.com>
Sun, 2 Nov 2014 16:46:56 +0000 (17:46 +0100)
committerAPTX <marek321@gmail.com>
Sun, 2 Nov 2014 16:46:56 +0000 (17:46 +0100)
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

index 0d675fda340b2b3065004c651a691fcbd66b8e82..308ef6ac6ac92fb1f05459ae9aadbae173cd613f 100644 (file)
@@ -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