summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorAkihiko Odaki2022-05-29 10:25:08 +0200
committerGerd Hoffmann2022-06-14 10:34:36 +0200
commit2910abd6b4364ee96d2339b2be8858246fcd3161 (patch)
tree528cfdd0b797d16b68e0d6e6e73870e73e012e23 /ui
parentui/gtk-gl-area: create the requested GL context version (diff)
downloadqemu-2910abd6b4364ee96d2339b2be8858246fcd3161.tar.gz
qemu-2910abd6b4364ee96d2339b2be8858246fcd3161.tar.xz
qemu-2910abd6b4364ee96d2339b2be8858246fcd3161.zip
ui/cocoa: Fix poweroff request code
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>
Diffstat (limited to 'ui')
-rw-r--r--ui/cocoa.m6
1 files changed, 5 insertions, 1 deletions
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 09a62817f2..84c84e98fc 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -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