Skip to content

fix(v3/macos): marshal application menu replacement to main thread #5909

Description

@leaanthony

Description\n\nCalling after startup from a Wails custom-event listener crashes a macOS application:\n\n\n\nWails dispatches custom-event listeners on worker goroutines. calls the macOS implementation directly, and ultimately calls without main-thread dispatch.\n\n### Reproduction\n\n1. Create and set an initial application menu.\n2. Register a custom-event listener.\n3. From the listener, replace the menu with .\n4. Emit the event from the frontend after startup.\n\nThe application aborts in .\n\n### Expected behavior\n\nApplication-menu replacement is safe from Wails callbacks. The macOS backend should execute synchronously on the AppKit main thread, while avoiding a synchronous self-dispatch when already on that thread.\n\n### Acceptance criteria\n\n- no longer crashes when called from a background/custom-event callback on macOS.\n- Calls already on the main thread do not deadlock.\n- Existing application menu behavior remains unchanged on other platforms.\n- The macOS application package tests and build pass.

Metadata

Metadata

Assignees

Labels

BugSomething isn't workingMacOSP2Medium priorityinvestigatingThe bug is being investigatedv3

Type

No type

Projects

Status
In Progress

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions