From a2191968ffcc8f462fd2d0272b35d58837a40948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Wed, 14 Oct 2026 22:05:17 -0700 Subject: [PATCH] macOS: Fixed Cmd+Q not quitting, and terminate called off the main thread. Closes #2655. (#4053) --- examples/common/entry/entry_osx.mm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/examples/common/entry/entry_osx.mm b/examples/common/entry/entry_osx.mm index e4f3932b3..c967ec751 100644 --- a/examples/common/entry/entry_osx.mm +++ b/examples/common/entry/entry_osx.mm @@ -74,7 +74,12 @@ namespace entry MainThreadEntry* self = (MainThreadEntry*)_userData; uint32_t result = main(self->m_argc, self->m_argv); - [NSApp terminate:nil]; + + dispatch_async(dispatch_get_main_queue() + , ^(void){ + [NSApp terminate:nil]; + }); + return result; } }; @@ -375,9 +380,11 @@ namespace entry // Returning false means that we take care of the key (instead of the default behavior) if (key != Key::None) { - if (key == Key::KeyQ && (modifiers & Modifier::RightMeta) ) + if (key == Key::KeyQ + && 0 != (modifiers & (Modifier::LeftMeta | Modifier::RightMeta) ) ) { - m_eventQueue.postExitEvent(); + [NSApp terminate:nil]; + return false; } else {