]> Git Repo - qemu.git/commitdiff
ui/cocoa: Do not exit immediately after shutdown
authorAkihiko Odaki <[email protected]>
Fri, 19 Feb 2021 11:16:52 +0000 (20:16 +0900)
committerGerd Hoffmann <[email protected]>
Mon, 15 Mar 2021 16:37:50 +0000 (17:37 +0100)
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 <[email protected]>
Message-Id: <20210219111652[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
ui/cocoa.m

index a7848ae0a30e175aeb3711cf7887a92cb9d7019d..9da0e884b71249b7be6eb961b3941c23564c22b6 100644 (file)
@@ -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
This page took 0.029584 seconds and 4 git commands to generate.