Browse Source

Kill the helper on shutdown/reboot.

Graham Booker 4 years ago
parent
commit
50feced1f3
2 changed files with 17 additions and 2 deletions
  1. 15 0
      src/power/PowerComponentDBus.cpp
  2. 2 2
      src/power/PowerComponentDBus.h

+ 15 - 0
src/power/PowerComponentDBus.cpp

@@ -3,6 +3,7 @@
 #include <QtDBus/QDBusReply>
 
 #include "PowerComponentDBus.h"
+#include "utils/HelperLauncher.h"
 
 #define DBUS_SERVICE_NAME "org.freedesktop.login1"
 #define DBUS_SERVICE_PATH "/org/freedesktop/login1"
@@ -12,6 +13,20 @@
 #define DBUS_SCREENSAVER_SERVICE_PATH "/org/freedesktop/ScreenSaver"
 #define DBUS_SCREENSAVER_INTERFACE "org.freedesktop.ScreenSaver"
 
+/////////////////////////////////////////////////////////////////////////////////////////
+bool PowerComponentDBus::PowerOff()
+{
+  HelperLauncher::Get().stop();
+  return callPowerMethod("PowerOff");
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+bool PowerComponentDBus::Reboot()
+{
+  HelperLauncher::Get().stop();
+  return callPowerMethod("Reboot");
+}
+
 /////////////////////////////////////////////////////////////////////////////////////////
 bool PowerComponentDBus::callPowerMethod(QString method)
 {

+ 2 - 2
src/power/PowerComponentDBus.h

@@ -23,8 +23,8 @@ class PowerComponentDBus : public PowerComponent
     return flags;
   }
 
-    virtual bool PowerOff() { return callPowerMethod("PowerOff"); }
-    virtual bool Reboot() { return callPowerMethod("Reboot"); }
+    virtual bool PowerOff();
+    virtual bool Reboot();
     virtual bool Suspend() { return callPowerMethod("Suspend"); }
 
   private: