tauri
tauri copied to clipboard
Updating menu_handle title from within on_menu_event causes death spiral
I have the following code in my Tauri application:
tauri::Builder::default()
.menu(menu)
.on_menu_event(move |event| {
match event.menu_item_id() {
"alwaysontop" => {
let _ = event.window().set_always_on_top(true);
let _ = event.window().menu_handle().get_item(event.menu_item_id()).set_title("test");
}
and the last let statement seems to throw my application into a Not Responding state.
Interestingly, the Webview part of the app continues to load successfully.
The end goal is to have a kind of "checkbox" menu item, where I insert a ✔️ into the menu item depending on the current "always on top" state.
Tauri 1.1.0, Windows 10.
can you try with #5245 there was a deadlock I fixed.
in src-tauri/Cargo.toml change tauri-build and tauri deps to:
[build-dependencies]
tauri-build = { git = "https://github.com/tauri-apps/tauri", branch = "fix-tray-cleanup" }
[dependencies]
tauri = { git = "https://github.com/tauri-apps/tauri", branch = "fix-tray-cleanup" }
after that run cargo update inside src-tauri and test the changes
Hey @amrbashir. No change unfortunately.
try with https://github.com/tauri-apps/tauri/pull/5257 instead
[build-dependencies]
tauri-build = { git = "https://github.com/tauri-apps/tauri", branch = "menu-deadlock" }
[dependencies]
tauri = { git = "https://github.com/tauri-apps/tauri", branch = "menu-deadlock" }
don't forget to run cargo update in src-tauri
@amrbashir I can confirm your menu-deadlock branch fixes the problem 🎉