mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-07 10:22:29 +02:00
This commit is contained in:
committed by
GitHub
parent
3bd3d923d3
commit
70ff55c1aa
6
.changes/fix-menu-event-macos.md
Normal file
6
.changes/fix-menu-event-macos.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"tauri": patch
|
||||
"tauri-runtime-wry": patch
|
||||
---
|
||||
|
||||
Fixes a panic when a menu event is triggered when all windows are minimized on macOS.
|
||||
@@ -2395,7 +2395,18 @@ fn handle_event_loop<T: UserEvent>(
|
||||
origin: MenuType::MenuBar,
|
||||
..
|
||||
} => {
|
||||
let window_id = window_id.unwrap(); // always Some on MenuBar event
|
||||
#[allow(unused_mut)]
|
||||
let mut window_id = window_id.unwrap(); // always Some on MenuBar event
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
// safety: we're only checking to see if the window_id is 0
|
||||
// which is the value sent by macOS when the window is minimized (NSApplication::sharedApplication::mainWindow is null)
|
||||
if window_id == unsafe { WindowId::dummy() } {
|
||||
window_id = *webview_id_map.0.lock().unwrap().keys().next().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
let event = MenuEvent {
|
||||
menu_item_id: menu_id.0,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user