From 62dbaaf02c94abac1ca88f8b4e699edbef7103c3 Mon Sep 17 00:00:00 2001
From: Connor McLaughlin <stenzek@gmail.com>
Date: Thu, 29 Oct 2020 17:38:25 +1000
Subject: [PATCH] Qt: Fix power off button not exiting in batch mode

---
 src/duckstation-qt/qthostinterface.cpp        | 8 +-------
 src/frontend-common/common_host_interface.cpp | 3 +++
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/duckstation-qt/qthostinterface.cpp b/src/duckstation-qt/qthostinterface.cpp
index 59ad0189d..780d866b8 100644
--- a/src/duckstation-qt/qthostinterface.cpp
+++ b/src/duckstation-qt/qthostinterface.cpp
@@ -765,13 +765,7 @@ void QtHostInterface::powerOffSystem()
     return;
   }
 
-  if (System::IsShutdown())
-    return;
-
-  if (g_settings.save_state_on_exit)
-    SaveResumeSaveState();
-
-  DestroySystem();
+  PowerOffSystem();
 }
 
 void QtHostInterface::synchronousPowerOffSystem()
diff --git a/src/frontend-common/common_host_interface.cpp b/src/frontend-common/common_host_interface.cpp
index 4e733c758..d820192a1 100644
--- a/src/frontend-common/common_host_interface.cpp
+++ b/src/frontend-common/common_host_interface.cpp
@@ -183,6 +183,9 @@ void CommonHostInterface::DestroySystem()
 
 void CommonHostInterface::PowerOffSystem()
 {
+  if (System::IsShutdown())
+    return;
+
   if (g_settings.save_state_on_exit)
     SaveResumeSaveState();