From 0cc15abfae6bca396b5506e644c2cf0d6331df21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=CC=84vels=20Nadtoc=CC=8Cajevs?= <7645683+bruvzg@users.noreply.github.com> Date: Thu, 4 Dec 2025 09:03:06 +0200 Subject: [PATCH] [macOS] Fix profiler cleanup. --- platform/macos/godot_main_macos.mm | 2 ++ platform/macos/os_macos.mm | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/platform/macos/godot_main_macos.mm b/platform/macos/godot_main_macos.mm index 3ab892d2df5..1efaee8c3d4 100644 --- a/platform/macos/godot_main_macos.mm +++ b/platform/macos/godot_main_macos.mm @@ -132,6 +132,8 @@ int main(int argc, char **argv) { os->run(); + // Note: `os->run()` will never return if `OS_MacOS_NSApp` is used. Use `OS_MacOS_NSApp::cleanup()` for cleanup. + int exit_code = os->get_exit_code(); memdelete(os); diff --git a/platform/macos/os_macos.mm b/platform/macos/os_macos.mm index b4a66d139a7..e591df64220 100644 --- a/platform/macos/os_macos.mm +++ b/platform/macos/os_macos.mm @@ -1076,7 +1076,7 @@ OS_MacOS::OS_MacOS(const char *p_execpath, int p_argc, char **p_argv) { // MARK: - OS_MacOS_NSApp void OS_MacOS_NSApp::run() { - [NSApp run]; + [NSApp run]; // Note: this call will never return. Use `OS_MacOS_NSApp::cleanup()` for cleanup. } static bool sig_received = false; @@ -1154,8 +1154,7 @@ void OS_MacOS_NSApp::start_main() { } void OS_MacOS_NSApp::terminate() { - godot_cleanup_profiler(); - + // Note: This method only sends app termination request. Use `OS_MacOS_NSApp::cleanup()` for cleanup. if (pre_wait_observer) { CFRunLoopRemoveObserver(CFRunLoopGetCurrent(), pre_wait_observer, kCFRunLoopCommonModes); CFRelease(pre_wait_observer); @@ -1175,6 +1174,7 @@ void OS_MacOS_NSApp::cleanup() { Main::cleanup(); } } + godot_cleanup_profiler(); } OS_MacOS_NSApp::OS_MacOS_NSApp(const char *p_execpath, int p_argc, char **p_argv) :