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

[bug] Panic when menu is triggered while on dev tools window on Mac #3875

Closed
BlueGreenMagick opened this issue Apr 9, 2022 · 2 comments
Closed

Comments

@BlueGreenMagick
Copy link

BlueGreenMagick commented Apr 9, 2022

Describe the bug

On a Mac, when you open the dev tools into a separate window, then click on a custom menu, the app crashes.

Reproduction

  1. Use a Mac.
  2. Create a custom menu using tauri::Builder::default().menu(menu())
  3. Execute app, open dev tools
  4. Detatch the dev tool into its own window.
  5. While the dev tool window is focused, click on a CustomMenuItem menu.
  6. Panic

Expected behavior

The app should not panic.

Platform and versions

Environment
  › OS: Mac OS 12.3.0 X64
  › Node.js: 16.14.0
  › npm: 8.3.1
  › pnpm: Not installed!
  › yarn: 1.22.17
  › rustup: 1.24.3
  › rustc: 1.58.1
  › cargo: 1.58.0
  › Rust toolchain: stable-aarch64-apple-darwin 

Packages
  › @tauri-apps/cli [NPM]: 1.0.0-rc.7
  › @tauri-apps/api [NPM]: 1.0.0-rc.3
  › tauri [RUST]: 1.0.0-rc.6 (no lockfile),
  › tauri-build [RUST]: no manifest (no lockfile),
  › tao [RUST]: no manifest (no lockfile),
  › wry [RUST]: no manifest (no lockfile),

App
  › build-type: bundle
  › CSP: default-src blob: data: filesystem: ws: wss: http: https: tauri: cover: epub: 'unsafe-eval' 'unsafe-inline' 'self' img-src:
  › distDir: ../public
  › devPath: http://localhost:7580/
  › framework: Svelte
  › bundler: Rollup

App directory structure
  ├─ web
  ├─ node_modules
  ├─ public
  ├─ src-tauri
  └─ .vscode

Stack trace

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-runtime-wry-0.3.5/src/lib.rs:128:36
stack backtrace:
   0:        0x103a61f98 - std::backtrace_rs::backtrace::libunwind::trace::h6812f5c12d344a73
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:        0x103a61f98 - std::backtrace_rs::backtrace::trace_unsynchronized::he7a14c6fb88ae25c
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:        0x103a61f98 - std::sys_common::backtrace::_print_fmt::h78452774aba0536d
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/sys_common/backtrace.rs:67:5
   3:        0x103a61f98 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h98d8e939df2a84c8
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/sys_common/backtrace.rs:46:22
   4:        0x103a7fa84 - core::fmt::write::ha8927896f8d44e8d
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/fmt/mod.rs:1149:17
   5:        0x103a5a978 - std::io::Write::write_fmt::h5be52fc0ae77f963
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/io/mod.rs:1697:15
   6:        0x103a63888 - std::sys_common::backtrace::_print::h541db45a3e9ffe20
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/sys_common/backtrace.rs:49:5
   7:        0x103a63888 - std::sys_common::backtrace::print::h29b0c38967f00a1d
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/sys_common/backtrace.rs:36:9
   8:        0x103a63888 - std::panicking::default_hook::{{closure}}::h7ab34c9d6fd8d067
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:211:50
   9:        0x103a63468 - std::panicking::default_hook::h6507a23c659c2199
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:228:9
  10:        0x103a63ec8 - std::panicking::rust_panic_with_hook::h032de7ae9e9d479f
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:606:17
  11:        0x103a639ec - std::panicking::begin_panic_handler::{{closure}}::ha7b561c0fbbe4ae5
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:500:13
  12:        0x103a62458 - std::sys_common::backtrace::__rust_end_short_backtrace::h0ff1db7619f9e51e
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/sys_common/backtrace.rs:139:18
  13:        0x103a6397c - rust_begin_unwind
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:498:5
  14:        0x103a96bb4 - core::panicking::panic_fmt::h660aa0926f67c6d3
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panicking.rs:107:14
  15:        0x103a96b38 - core::panicking::panic::h87e190dcd64449c6
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panicking.rs:48:5
  16:        0x10354c610 - core::option::Option<T>::unwrap::hf23cf591e7972f6f
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/option.rs:746:21
  17:        0x103547c48 - tauri_runtime_wry::WebviewIdStore::get::hd771987ffdbfc6a0
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-runtime-wry-0.3.5/src/lib.rs:128:6
  18:        0x103187520 - tauri_runtime_wry::handle_event_loop::hbd101c59117a998a
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-runtime-wry-0.3.5/src/lib.rs:2402:25
  19:        0x10318a480 - <tauri_runtime_wry::Wry<T> as tauri_runtime::Runtime<T>>::run::{{closure}}::h24ecbf23bfd2ea75
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-runtime-wry-0.3.5/src/lib.rs:1954:7
  20:        0x102fa56e4 - <tao::platform_impl::platform::app_state::EventLoopHandler<T> as tao::platform_impl::platform::app_state::EventHandler>::handle_nonuser_event::{{closure}}::hd772b9c6f9f52152
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/app_state.rs:104:9
  21:        0x102fa5c78 - tao::platform_impl::platform::app_state::EventLoopHandler<T>::with_callback::h6452cabf67ae8b85
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/app_state.rs:78:7
  22:        0x102fa5578 - <tao::platform_impl::platform::app_state::EventLoopHandler<T> as tao::platform_impl::platform::app_state::EventHandler>::handle_nonuser_event::hac2dd704dc11bd68
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/app_state.rs:99:5
  23:        0x1035e5680 - tao::platform_impl::platform::app_state::Handler::handle_nonuser_event::hdd6fa02bd3813799
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/app_state.rs:208:11
  24:        0x1035e6e88 - tao::platform_impl::platform::app_state::AppState::cleared::hebfe8149b14b46e3
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/app_state.rs:380:9
  25:        0x1035cb380 - tao::platform_impl::platform::observer::control_flow_end_handler::{{closure}}::h8db2783a335e4f1c
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/observer.rs:186:11
  26:        0x1035cb188 - tao::platform_impl::platform::observer::control_flow_handler::{{closure}}::h61f3d8c2b48869e0
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/observer.rs:147:5
  27:        0x1035c4d54 - std::panicking::try::do_call::h542343f086d98dd4
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:406:40
  28:        0x1035c7fc4 - <unknown>
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/vec/drain.rs:88:73
  29:        0x1035c4bd4 - std::panicking::try::h585d732acb7fa7ca
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:370:19
  30:        0x1035d623c - std::panic::catch_unwind::h22cbe84ebec5230d
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panic.rs:133:14
  31:        0x1035b3300 - tao::platform_impl::platform::event_loop::stop_app_on_panic::h54e5520650a2e54a
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/event_loop.rs:224:9
  32:        0x1035cafd8 - tao::platform_impl::platform::observer::control_flow_handler::hc352f7c7704cd6e2
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/observer.rs:145:3
  33:        0x1035cb308 - tao::platform_impl::platform::observer::control_flow_end_handler::h45b5967f6c8eac19
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/observer.rs:181:5
  34:        0x19a811bb0 - <unknown>
  35:        0x19a811a00 - <unknown>
  36:        0x19a81104c - <unknown>
  37:        0x19a810490 - <unknown>
  38:        0x1a3430dd8 - <unknown>
  39:        0x1a3430b54 - <unknown>
  40:        0x1a3430908 - <unknown>
  41:        0x19d36fbcc - <unknown>
  42:        0x19d36e4c4 - <unknown>
  43:        0x19d360690 - <unknown>
  44:        0x1036ecea4 - <() as objc::message::MessageArguments>::invoke::h65d808a3282ee8f9
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/objc-0.2.7/src/message/mod.rs:128:17
  45:        0x10370ff44 - objc::message::platform::send_unverified::{{closure}}::h00ace68adb9fa094
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/objc-0.2.7/src/message/apple/mod.rs:27:9
  46:        0x103709f94 - objc_exception::try::{{closure}}::hc017f4dc068fa6e9
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/objc_exception-0.1.2/src/lib.rs:68:31
  47:        0x103706bc4 - objc_exception::try_no_ret::try_objc_execute_closure::h03c76000a0d706a8
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/objc_exception-0.1.2/src/lib.rs:34:9
  48:        0x10372ae64 - RustObjCExceptionTryCatch
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/objc_exception-0.1.2/extern/exception.m:10:9
  49:        0x1037060a8 - objc_exception::try_no_ret::h91b13fc8d0417b38
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/objc_exception-0.1.2/src/lib.rs:44:19
  50:        0x103708388 - objc_exception::try::h53b01888e35d1c6d
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/objc_exception-0.1.2/src/lib.rs:67:9
  51:        0x10371555c - objc::exception::try::hb4ace2dd94fabd61
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/objc-0.2.7/src/exception.rs:8:5
  52:        0x10370f424 - objc::message::platform::send_unverified::ha378d1adfe11b78c
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/objc-0.2.7/src/message/apple/mod.rs:26:5
  53:        0x103159700 - objc::message::send_message::h5afcff61e6dc3413
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/objc-0.2.7/src/message/mod.rs:178:5
  54:        0x103159700 - tao::platform_impl::platform::event_loop::EventLoop<T>::run_return::hdf2e340436f8e8f6
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/event_loop.rs:181:16
  55:        0x10315a404 - tao::platform_impl::platform::event_loop::EventLoop<T>::run::h7c1c74e3682733ed
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/platform_impl/macos/event_loop.rs:148:21
  56:        0x102ff820c - tao::event_loop::EventLoop<T>::run::h193b36b3bf17138e
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tao-0.7.0/src/event_loop.rs:177:5
  57:        0x10318a1d0 - <tauri_runtime_wry::Wry<T> as tauri_runtime::Runtime<T>>::run::h74c779d36d25dba3
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-runtime-wry-0.3.5/src/lib.rs:1953:5
  58:        0x102f9e120 - tauri::app::App<R>::run::he57be246a1461da9
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-1.0.0-rc.6/src/app.rs:614:5
  59:        0x102f9e7fc - tauri::app::Builder<R>::run::hcc4e2ac492408a8b
                               at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-1.0.0-rc.6/src/app.rs:1482:5
  60:        0x102ee9d10 - app::main::h60ec3f47d29d5fc0
                               at ~/Code/tuuli/desktop/src-tauri/src/main.rs:35:11
  61:        0x102f64dac - core::ops::function::FnOnce::call_once::h6cdeb8405269f475
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/ops/function.rs:227:5
  62:        0x102ee6240 - std::sys_common::backtrace::__rust_begin_short_backtrace::h936c4137f1d6c897
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/sys_common/backtrace.rs:123:18
  63:        0x102ee6fc8 - std::rt::lang_start::{{closure}}::h60a79458e536adfc
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/rt.rs:145:18
  64:        0x103a61cc8 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h10f2582b16e2b13c
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/ops/function.rs:259:13
  65:        0x103a61cc8 - std::panicking::try::do_call::hd3dfc31f9ced2f42
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:406:40
  66:        0x103a61cc8 - std::panicking::try::h584945b02ec0e15d
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:370:19
  67:        0x103a61cc8 - std::panic::catch_unwind::h1138cecd37279bb6
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panic.rs:133:14
  68:        0x103a61cc8 - std::rt::lang_start_internal::{{closure}}::hf94f7401539e24a6
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/rt.rs:128:48
  69:        0x103a61cc8 - std::panicking::try::do_call::ha8b5def05088e3d3
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:406:40
  70:        0x103a61cc8 - std::panicking::try::h3ce579dae5f3a6fb
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:370:19
  71:        0x103a61cc8 - std::panic::catch_unwind::h29ecbe0d385e9017
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panic.rs:133:14
  72:        0x103a61cc8 - std::rt::lang_start_internal::h35c587f98e9244f6
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/rt.rs:128:20
  73:        0x102ee6f94 - std::rt::lang_start::h5468f520e6945e37
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/rt.rs:144:17
  74:        0x102eea8ac - <unknown>

Additional context

No response

@JonasKruckenberg
Copy link
Contributor

Looking at the line that is referenced in the stacktrace this makes a lot of sense:

*self.0.lock().unwrap().get(w).unwrap()

It is trying to access the window, but the windowId of that devtools window is not managed by Tauri. I don't really know what to do here though except maybe improve the error handling. I.e. not panicking

@BlueGreenMagick
Copy link
Author

It would be ideal if it returned the window the dev tool is inspecting. So the menu keeps working as expected. I don't know if it's feasible though 🤷

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

No branches or pull requests

3 participants