Browse Source

Merge pull request #104615 from bruvzg/cleanup_fix

[macOS] Fix cleanup with some command line tools.
Rémi Verschelde 5 months ago
parent
commit
594d64ec24
2 changed files with 4 additions and 4 deletions
  1. 1 1
      platform/macos/godot_application_delegate.mm
  2. 3 3
      platform/macos/os_macos.mm

+ 1 - 1
platform/macos/godot_application_delegate.mm

@@ -240,7 +240,7 @@
 
 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender {
 	DisplayServerMacOS *ds = (DisplayServerMacOS *)DisplayServer::get_singleton();
-	if (ds) {
+	if (ds && ds->has_window(DisplayServerMacOS::MAIN_WINDOW_ID)) {
 		ds->send_window_event(ds->get_window(DisplayServerMacOS::MAIN_WINDOW_ID), DisplayServerMacOS::WINDOW_EVENT_CLOSE_REQUEST);
 	}
 	OS_MacOS *os = (OS_MacOS *)OS::get_singleton();

+ 3 - 3
platform/macos/os_macos.mm

@@ -882,9 +882,9 @@ void OS_MacOS::terminate() {
 void OS_MacOS::cleanup() {
 	if (main_loop) {
 		main_loop->finalize();
-		@autoreleasepool {
-			Main::cleanup();
-		}
+	}
+	@autoreleasepool {
+		Main::cleanup();
 	}
 }