You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Selecting a menu (e.g. Open...) when a window is minimized in macOS causes the application to panic.
Reproduction
Use the template with the default selected.
npx create-tauri-app
src-tauri/src/main.rs:
use tauri::api::dialog;use tauri::{CustomMenuItem,Menu,Submenu};fnmain(){let menu = Menu::new().add_submenu(Submenu::new("File",Menu::new().add_item(CustomMenuItem::new("open","Open...")),));
tauri::Builder::default().menu(menu).on_menu_event(|event| {if event.menu_item_id() == "open"{
dialog::FileDialogBuilder::new().pick_file(|f| {ifletSome(fpath) = f {println!("{:?}", fpath);}})}}).run(tauri::generate_context!()).expect("error while running tauri application");}
Launch that app and minimize its window.
Select Open... from the Window menu.
npx tauri dev
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-runtime-wry-0.3.5/src/lib.rs:130:40
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Expected behavior
Do not fire CustomMenuItem events when the window is minimized.
Or implement window.isMinimized() so that the developer can detect the state of window minimization.
$ RUST_BACKTRACE=1 npx tauri dev
Finished dev [unoptimized + debuginfo] target(s) in 0.08s
Running `target/debug/app`
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-runtime-wry-0.3.5/src/lib.rs:130:40
stack backtrace:
0: rust_begin_unwind
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/panicking.rs:143:14
2: core::panicking::panic
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/panicking.rs:48:5
3: core::option::Option<T>::unwrap
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/option.rs:752:21
4: tauri_runtime_wry::WebviewIdStore::get
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-runtime-wry-0.3.5/src/lib.rs:130:10
5: tauri_runtime_wry::handle_event_loop
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-runtime-wry-0.3.5/src/lib.rs:2410:33
6: <tauri_runtime_wry::Wry<T> as tauri_runtime::Runtime<T>>::run::{{closure}}
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-runtime-wry-0.3.5/src/lib.rs:1953:13
7: <tao::platform_impl::platform::app_state::EventLoopHandler<T> as tao::platform_impl::platform::app_state::EventHandler>::handle_nonuser_event::{{closure}}
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/app_state.rs:104:9
8: tao::platform_impl::platform::app_state::EventLoopHandler<T>::with_callback
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/app_state.rs:78:7
9: <tao::platform_impl::platform::app_state::EventLoopHandler<T> as tao::platform_impl::platform::app_state::EventHandler>::handle_nonuser_event
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/app_state.rs:99:5
10: tao::platform_impl::platform::app_state::Handler::handle_nonuser_event
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/app_state.rs:208:11
11: tao::platform_impl::platform::app_state::AppState::cleared
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/app_state.rs:380:9
12: tao::platform_impl::platform::observer::control_flow_end_handler::{{closure}}
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/observer.rs:186:11
13: tao::platform_impl::platform::observer::control_flow_handler::{{closure}}
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/observer.rs:147:5
14: std::panicking::try::do_call
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:492:40
15: ___rust_try
16: std::panicking::try
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:456:19
17: std::panic::catch_unwind
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panic.rs:137:14
18: tao::platform_impl::platform::event_loop::stop_app_on_panic
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/event_loop.rs:224:9
19: tao::platform_impl::platform::observer::control_flow_handler
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/observer.rs:145:3
20: tao::platform_impl::platform::observer::control_flow_end_handler
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/observer.rs:181:5
21: <unknown>
22: <unknown>
23: <unknown>
24: <unknown>
25: <unknown>
26: <unknown>
27: <unknown>
28: <unknown>
29: <unknown>
30: <unknown>
31: <() as objc::message::MessageArguments>::invoke
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/objc-0.2.7/src/message/mod.rs:128:17
32: objc::message::platform::send_unverified::{{closure}}
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/objc-0.2.7/src/message/apple/mod.rs:27:9
33: objc_exception::try::{{closure}}
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/objc_exception-0.1.2/src/lib.rs:68:31
34: objc_exception::try_no_ret::try_objc_execute_closure
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/objc_exception-0.1.2/src/lib.rs:34:9
35: RustObjCExceptionTryCatch
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/objc_exception-0.1.2/extern/exception.m:10:9
36: objc_exception::try_no_ret
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/objc_exception-0.1.2/src/lib.rs:44:19
37: objc_exception::try
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/objc_exception-0.1.2/src/lib.rs:67:9
38: objc::exception::try
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/objc-0.2.7/src/exception.rs:8:5
39: objc::message::platform::send_unverified
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/objc-0.2.7/src/message/apple/mod.rs:26:5
40: objc::message::send_message
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/objc-0.2.7/src/message/mod.rs:178:5
41: tao::platform_impl::platform::event_loop::EventLoop<T>::run_return
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/event_loop.rs:181:16
42: tao::platform_impl::platform::event_loop::EventLoop<T>::run
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/event_loop.rs:148:21
43: tao::event_loop::EventLoop<T>::run
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/event_loop.rs:177:5
44: <tauri_runtime_wry::Wry<T> as tauri_runtime::Runtime<T>>::run
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-runtime-wry-0.3.5/src/lib.rs:1952:9
45: tauri::app::App<R>::run
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-1.0.0-rc.6/src/app.rs:614:5
46: tauri::app::Builder<R>::run
at $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-1.0.0-rc.6/src/app.rs:1482:5
47: app::main
at ./src/main.rs:14:5
48: core::ops::function::FnOnce::call_once
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full`for a verbose backtrace.
Additional context
No response
The text was updated successfully, but these errors were encountered:
sprout2000
changed the title
[bug] Panic when firing menu event when window is minimized on macOS.
[bug] Panic while firing menu event when window is minimized on macOS.
Apr 19, 2022
Describe the bug
Selecting a menu (e.g.
Open...
) when a window is minimized in macOS causes the application to panic.Reproduction
src-tauri/src/main.rs
:Launch that app and minimize its window.
Select
Open...
from the Window menu.Expected behavior
Do not fire CustomMenuItem events when the window is minimized.
Or implement
window.isMinimized()
so that the developer can detect the state of window minimization.Platform and versions
Stack trace
Additional context
No response
The text was updated successfully, but these errors were encountered: