]> www.infradead.org Git - qemu-nvme.git/commitdiff
ui/cocoa: Fix poweroff request code
authorAkihiko Odaki <akihiko.odaki@gmail.com>
Sun, 29 May 2022 08:25:08 +0000 (17:25 +0900)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 14 Jun 2022 08:34:36 +0000 (10:34 +0200)
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220529082508.89097-1-akihiko.odaki@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
ui/cocoa.m

index 09a62817f2a982ea1697d247fa49c85c4187b3e7..84c84e98fc5ebfb6cf797da88f49cf9b65a9fdac 100644 (file)
@@ -35,6 +35,7 @@
 #include "ui/kbd-state.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/runstate.h"
+#include "sysemu/runstate-action.h"
 #include "sysemu/cpu-throttle.h"
 #include "qapi/error.h"
 #include "qapi/qapi-commands-block.h"
@@ -1290,7 +1291,10 @@ static CGEventRef handleTapEvent(CGEventTapProxy proxy, CGEventType type, CGEven
 {
     COCOA_DEBUG("QemuCocoaAppController: applicationWillTerminate\n");
 
-    qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI);
+    with_iothread_lock(^{
+        shutdown_action = SHUTDOWN_ACTION_POWEROFF;
+        qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI);
+    });
 
     /*
      * Sleep here, because returning will cause OSX to kill us