5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-17 01:19:29 +08:00

[darwin] Ensure menu updates occur on main thread

This commit is contained in:
Lea Anthony 2025-02-23 15:46:03 +11:00
parent d5a8f1e323
commit a5e2e42a55
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405
2 changed files with 9 additions and 6 deletions

View File

@ -89,6 +89,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed hidden menu items on macOS by [@leaanthony](https://github.com/leaanthony) - Fixed hidden menu items on macOS by [@leaanthony](https://github.com/leaanthony)
- Fixed handling and formatting of errors in message processors by [@fbbdev](https://github.com/fbbdev) in [#4066](https://github.com/wailsapp/wails/pull/4066) - Fixed handling and formatting of errors in message processors by [@fbbdev](https://github.com/fbbdev) in [#4066](https://github.com/wailsapp/wails/pull/4066)
-  Fixed skipped service shutdown when quitting application by [@fbbdev](https://github.com/fbbdev) in [#4066](https://github.com/wailsapp/wails/pull/4066) -  Fixed skipped service shutdown when quitting application by [@fbbdev](https://github.com/fbbdev) in [#4066](https://github.com/wailsapp/wails/pull/4066)
-  Ensure menu updates occur on the main thread by [@leaanthony](https://github.com/leaanthony)
### Changed ### Changed

View File

@ -72,12 +72,14 @@ func newMenuImpl(menu *Menu) *macosMenu {
} }
func (m *macosMenu) update() { func (m *macosMenu) update() {
InvokeSync(func() {
if m.nsMenu == nil { if m.nsMenu == nil {
m.nsMenu = C.createNSMenu(C.CString(m.menu.label)) m.nsMenu = C.createNSMenu(C.CString(m.menu.label))
} else { } else {
C.clearMenu(m.nsMenu) C.clearMenu(m.nsMenu)
} }
m.processMenu(m.nsMenu, m.menu) m.processMenu(m.nsMenu, m.menu)
})
} }
func (m *macosMenu) processMenu(parent unsafe.Pointer, menu *Menu) { func (m *macosMenu) processMenu(parent unsafe.Pointer, menu *Menu) {