File tree Expand file tree Collapse file tree
core/tauri-runtime-wry/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " tauri " : patch
3+ " tauri-runtime-wry " : patch
4+ ---
5+
6+ Fixes a panic when a menu event is triggered when all windows are minimized on macOS.
Original file line number Diff line number Diff line change @@ -2395,7 +2395,18 @@ fn handle_event_loop<T: UserEvent>(
23952395 origin : MenuType :: MenuBar ,
23962396 ..
23972397 } => {
2398- let window_id = window_id. unwrap ( ) ; // always Some on MenuBar event
2398+ #[ allow( unused_mut) ]
2399+ let mut window_id = window_id. unwrap ( ) ; // always Some on MenuBar event
2400+
2401+ #[ cfg( target_os = "macos" ) ]
2402+ {
2403+ // safety: we're only checking to see if the window_id is 0
2404+ // which is the value sent by macOS when the window is minimized (NSApplication::sharedApplication::mainWindow is null)
2405+ if window_id == unsafe { WindowId :: dummy ( ) } {
2406+ window_id = * webview_id_map. 0 . lock ( ) . unwrap ( ) . keys ( ) . next ( ) . unwrap ( ) ;
2407+ }
2408+ }
2409+
23992410 let event = MenuEvent {
24002411 menu_item_id : menu_id. 0 ,
24012412 } ;
You can’t perform that action at this time.
0 commit comments