Skip to content

Commit 2910abd

Browse files
akihikodakikraxel
authored andcommitted
ui/cocoa: Fix poweroff request code
Signed-off-by: Akihiko Odaki <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-Id: <[email protected]> Signed-off-by: Gerd Hoffmann <[email protected]>
1 parent 0905367 commit 2910abd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ui/cocoa.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "ui/kbd-state.h"
3636
#include "sysemu/sysemu.h"
3737
#include "sysemu/runstate.h"
38+
#include "sysemu/runstate-action.h"
3839
#include "sysemu/cpu-throttle.h"
3940
#include "qapi/error.h"
4041
#include "qapi/qapi-commands-block.h"
@@ -1290,7 +1291,10 @@ - (void)applicationWillTerminate:(NSNotification *)aNotification
12901291
{
12911292
COCOA_DEBUG("QemuCocoaAppController: applicationWillTerminate\n");
12921293

1293-
qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI);
1294+
with_iothread_lock(^{
1295+
shutdown_action = SHUTDOWN_ACTION_POWEROFF;
1296+
qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI);
1297+
});
12941298

12951299
/*
12961300
* Sleep here, because returning will cause OSX to kill us

0 commit comments

Comments
 (0)