Skip to content

Commit 98954c5

Browse files
committed
Merge pull request #113547 from bruvzg/mac_clean
[macOS] Fix profiler cleanup.
2 parents 8f3801a + 0cc15ab commit 98954c5

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

platform/macos/godot_main_macos.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ int main(int argc, char **argv) {
132132

133133
os->run();
134134

135+
// Note: `os->run()` will never return if `OS_MacOS_NSApp` is used. Use `OS_MacOS_NSApp::cleanup()` for cleanup.
136+
135137
int exit_code = os->get_exit_code();
136138

137139
memdelete(os);

platform/macos/os_macos.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@
10761076
// MARK: - OS_MacOS_NSApp
10771077

10781078
void OS_MacOS_NSApp::run() {
1079-
[NSApp run];
1079+
[NSApp run]; // Note: this call will never return. Use `OS_MacOS_NSApp::cleanup()` for cleanup.
10801080
}
10811081

10821082
static bool sig_received = false;
@@ -1154,8 +1154,7 @@ static void handle_interrupt(int sig) {
11541154
}
11551155

11561156
void OS_MacOS_NSApp::terminate() {
1157-
godot_cleanup_profiler();
1158-
1157+
// Note: This method only sends app termination request. Use `OS_MacOS_NSApp::cleanup()` for cleanup.
11591158
if (pre_wait_observer) {
11601159
CFRunLoopRemoveObserver(CFRunLoopGetCurrent(), pre_wait_observer, kCFRunLoopCommonModes);
11611160
CFRelease(pre_wait_observer);
@@ -1175,6 +1174,7 @@ static void handle_interrupt(int sig) {
11751174
Main::cleanup();
11761175
}
11771176
}
1177+
godot_cleanup_profiler();
11781178
}
11791179

11801180
OS_MacOS_NSApp::OS_MacOS_NSApp(const char *p_execpath, int p_argc, char **p_argv) :

0 commit comments

Comments
 (0)