aboutsummaryrefslogtreecommitdiff
path: root/ui/cocoa.m
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki@gmail.com>2021-02-19 20:16:52 +0900
committerGerd Hoffmann <kraxel@redhat.com>2021-03-15 17:37:50 +0100
commit40c0193739eb08f76505f736c259928279d0376a (patch)
tree966c50293c088391558c1bbc07b24c9c842350eb /ui/cocoa.m
parent14c235eb40eb82e0d7e89601b1a47028fe24deca (diff)
ui/cocoa: Do not exit immediately after shutdown
ui/cocoa used to call exit immediately after calling qemu_system_shutdown_request, which prevents QEMU from actually perfoming system shutdown. Just sleep forever, and wait QEMU to call exit and kill the Cocoa thread. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210219111652.20623-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/cocoa.m')
-rw-r--r--ui/cocoa.m8
1 files changed, 7 insertions, 1 deletions
diff --git a/ui/cocoa.m b/ui/cocoa.m
index a7848ae0a3..9da0e884b7 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1115,7 +1115,13 @@ QemuCocoaView *cocoaView;
COCOA_DEBUG("QemuCocoaAppController: applicationWillTerminate\n");
qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI);
- exit(0);
+
+ /*
+ * Sleep here, because returning will cause OSX to kill us
+ * immediately; the QEMU main loop will handle the shutdown
+ * request and terminate the process.
+ */
+ [NSThread sleepForTimeInterval:INFINITY];
}
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication