From 342e572d902921ed4b058a80402e83110f4ed807 Mon Sep 17 00:00:00 2001 From: Piyush Aggarwal Date: Thu, 12 Sep 2019 17:46:10 +0000 Subject: [PATCH] reliably close daemon and indicator when quitting on Windows and MacOS --- indicator/main.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/indicator/main.cpp b/indicator/main.cpp index 1e7b54fa7..738d56ce2 100644 --- a/indicator/main.cpp +++ b/indicator/main.cpp @@ -60,7 +60,7 @@ int main(int argc, char** argv) #ifdef Q_OS_MAC // Unset launchctl env, avoid block DBusHelper::macosUnsetLaunchctlEnv(); - + // Start kdeconnectd QProcess kdeconnectdProcess; if (QFile::exists(QCoreApplication::applicationDirPath() + QStringLiteral("/kdeconnectd"))) { @@ -151,8 +151,12 @@ int main(int argc, char** argv) QStringLiteral("/MainApplication"), QStringLiteral("org.qtproject.Qt.QCoreApplication"), QStringLiteral("quit")); - DBusHelper::sessionBus().call(message); - QCoreApplication::quit(); // Close this application + DBusHelper::sessionBus().call(message, QDBus::NoBlock); // Close our daemon + message = QDBusMessage::createMethodCall(qApp->applicationName(), + QStringLiteral("/MainApplication"), + QStringLiteral("org.qtproject.Qt.QCoreApplication"), + QStringLiteral("quit")); + DBusHelper::sessionBus().call(message, QDBus::NoBlock); // Close our indicator }); #endif };