Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating menu_handle title from within on_menu_event causes death spiral #5254

Closed
nanodeath opened this issue Sep 21, 2022 · 4 comments
Closed

Comments

@nanodeath
Copy link

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.

@amrbashir amrbashir transferred this issue from tauri-apps/tao Sep 21, 2022
@amrbashir
Copy link
Member

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

@nanodeath
Copy link
Author

Hey @amrbashir. No change unfortunately.

@amrbashir
Copy link
Member

try with #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

@nanodeath
Copy link
Author

@amrbashir I can confirm your menu-deadlock branch fixes the problem 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants