From f7c063bf14d15c348676148256cebeeebcdfddf5 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov <arvidjaar@mail.ru> Date: Tue, 9 Mar 2010 21:07:06 +0300 Subject: [PATCH 6/6] ksyndaemon was not terminated on session logout I must honestly admit that I do not quite understand why it did not do it and why it does it now. I suspect the way it was used created two independent instances of KApplication inside of single process and the wrong one got information about session termination. It also provides more clean D-Bus interface limiting KSyndaemon interface to what it actually offers. --- ksyndaemon/ksyndaemon.cpp | 4 ++-- ksyndaemon/ksyndaemon.h | 4 ++-- ksyndaemon/main.cpp | 9 +++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ksyndaemon/ksyndaemon.cpp b/ksyndaemon/ksyndaemon.cpp index 8612286..979929c 100644 --- a/ksyndaemon/ksyndaemon.cpp +++ b/ksyndaemon/ksyndaemon.cpp @@ -29,8 +29,8 @@ #include "ksyndaemon.h" #include "ksyndaemonadaptor.h" -KSyndaemon::KSyndaemon(void) - : KUniqueApplication(false), +KSyndaemon::KSyndaemon(QObject *parent) + : QObject(parent), m_interval(1), m_cmd("exec syndaemon -R -i "), daemon() diff --git a/ksyndaemon/ksyndaemon.h b/ksyndaemon/ksyndaemon.h index 52a57b6..2ad6f7f 100644 --- a/ksyndaemon/ksyndaemon.h +++ b/ksyndaemon/ksyndaemon.h @@ -24,13 +24,13 @@ #include <KUniqueApplication> #include <KProcess> -class KSyndaemon : public KUniqueApplication +class KSyndaemon : public QObject { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.kde.KSyndaemon") public: - KSyndaemon(); + KSyndaemon(QObject *parent = NULL); ~KSyndaemon(); public Q_SLOTS: diff --git a/ksyndaemon/main.cpp b/ksyndaemon/main.cpp index ad97348..9d885f1 100644 --- a/ksyndaemon/main.cpp +++ b/ksyndaemon/main.cpp @@ -35,10 +35,10 @@ int main(int argc, char **argv) aboutdata.setBugAddress("http://kde-apps.org/content/show.php/kcm_touchpad?content=113335"); KCmdLineArgs::init( argc, argv, &aboutdata ); - KSyndaemon::addCmdLineOptions(); + KUniqueApplication::addCmdLineOptions(); // initialize application - if ( !KSyndaemon::start() ) { + if ( !KUniqueApplication::start() ) { kDebug() << "Running ksyndaemon found"; return 0; } @@ -46,10 +46,11 @@ int main(int argc, char **argv) // do not connect to ksmserver at all, ksyndaemon is launched on demand // and doesn't need to know about logout unsetenv( "SESSION_MANAGER" ); - KSyndaemon(app); + KUniqueApplication app; // start syndaemon + KSyndaemon syndaemon; // listen to D-Bus reconfiguration events - app.exec(); + return app.exec(); } -- 1.7.0.2