Skip to content

cocoa: submit a follow-up event after shutting down Cocoa event loop#4395

Open
rokm wants to merge 1 commit into
beeware:mainfrom
rokm:fix-macos-app-shutdown
Open

cocoa: submit a follow-up event after shutting down Cocoa event loop#4395
rokm wants to merge 1 commit into
beeware:mainfrom
rokm:fix-macos-app-shutdown

Conversation

@rokm
Copy link
Copy Markdown
Contributor

@rokm rokm commented May 12, 2026

Have toga_coca.app.App.exit() submit a follow-up event after shutting down the Cocoa event loop, to ensure that the post-stop processing occurs and that application can be closed without any user interaction.

This is necessary because rubicon-objc 0.5.4 changed CocoaLifecycle.stop() to call NSApplication.stop() instead of NSApplication.terminate(), and therefore the event loop does not exit until next event is received and processed.

Fixes #4394.

PR Checklist:

  • I will abide by the BeeWare Code of Conduct
  • I have read and have followed the CONTRIBUTING.md file
  • This PR was generated or assisted using an AI tool

@rokm rokm force-pushed the fix-macos-app-shutdown branch from 48b931c to b532ad5 Compare May 12, 2026 12:06
Have `toga_coca.app.App.exit()` submit a follow-up event after shutting
down the Cocoa event loop, to ensure that the post-stop processing occurs
and that application can be closed without any user interaction.

This is necessary because `rubicon-objc` 0.5.4 changed `CocoaLifecycle.stop()`
to call `NSApplication.stop()` instead of `NSApplication.terminate()`,
and therefore the event loop does not exit until next event is received
and processed.

Fixes beeware#4394.
@rokm rokm force-pushed the fix-macos-app-shutdown branch from b532ad5 to 66a07f4 Compare May 12, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS/Cocoa application cannot be programmatically closed w/o user interaction (v0.5.4)

1 participant