Skip to contentSkip to conversation

ui/cocoa: Fix poweroff request code

PATCH Philippe Mathieu-Daudé via 2 participants 2 messages May 29, 2022 – Jun 9, 2022 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Philippe Mathieu-Daudé via

author Reviewed-by Philippe Mathieu-Daudé
#1 lore raw
Quoted 19 lines · Akihiko Odaki
---
  ui/cocoa.m | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
ui/cocoa.m +1 -0
index 09a62817f2a..84c84e98fc5 100644
@@ -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 @@ - (void)applicationWillTerminate:(NSNotification *)aNotification
  {

ui/cocoa.m - (void)applicationWillTerminate:(NSNotification *)aNotification · line 1300

Quoted 10 lines
ui/cocoa.m +4 -1
      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
#2 lore raw
Quoted 22 lines · Philippe Mathieu-Daudé
Quoted 21 lines · Akihiko Odaki
---
  ui/cocoa.m | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
ui/cocoa.m +1 -1
index 09a62817f2a..84c84e98fc5 100644
@@ -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 @@ - (void)applicationWillTerminate:(NSNotification *)aNotification
  {
      COCOA_DEBUG("QemuCocoaAppController: applicationWillTerminate\n");
-    qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI);
Quoted 8 lines

ui/cocoa.m - (void)applicationWillTerminate:(NSNotification *)aNotification · line 1298

Quoted 6 lines
ui/cocoa.m +4 -0
+    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

Added to queue.

thanks,
Gerd