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

Panic in window resume unwrap assuming a monitor exists #3376

Closed
matthiasbeyer opened this issue Dec 17, 2024 · 0 comments · Fixed by #3609
Closed

Panic in window resume unwrap assuming a monitor exists #3376

matthiasbeyer opened this issue Dec 17, 2024 · 0 comments · Fixed by #3609
Labels
bug Something isn't working cli Related to the dioxus-cli program
Milestone

Comments

@matthiasbeyer
Copy link

matthiasbeyer commented Dec 17, 2024

let monitor = window.current_monitor().unwrap();

This line unwraps a None for me with the generated code from dx init.
I do not get a windows showing anything, but I have to Ctrl-C me out of there and then I get the output. With RUST_BACKTRACE=1 I get:

^Cthread 'main' panicked at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dioxus-desktop-0.6.0/src/app.rs:451:52:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0: rust_begin_unwind
             at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panicking.rs:665:5
   1: core::panicking::panic_fmt
             at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/panicking.rs:74:14
   2: core::panicking::panic
             at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/panicking.rs:148:5
   3: core::option::unwrap_failed
             at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/option.rs:2012:5
   4: core::option::Option<T>::unwrap
             at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/option.rs:972:21
   5: dioxus_desktop::app::App::persist_window_state
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dioxus-desktop-0.6.0/src/app.rs:451:27
   6: dioxus_desktop::app::App::handle_loop_destroyed
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dioxus-desktop-0.6.0/src/app.rs:443:9
   7: dioxus_desktop::launch::launch_virtual_dom_blocking::{{closure}}
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dioxus-desktop-0.6.0/src/launch.rs:29:37
   8: tao::platform_impl::platform::event_loop::EventLoop<T>::run_return::{{closure}}
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.30.0/src/platform_impl/linux/event_loop.rs:1002:17
   9: glib::main_context::<impl glib::auto::main_context::MainContext>::with_thread_default
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/glib-0.18.5/src/main_context.rs:154:12
  10: tao::platform_impl::platform::event_loop::EventLoop<T>::run_return
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.30.0/src/platform_impl/linux/event_loop.rs:932:5
  11: tao::platform_impl::platform::event_loop::EventLoop<T>::run
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.30.0/src/platform_impl/linux/event_loop.rs:886:21
  12: tao::event_loop::EventLoop<T>::run
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.30.0/src/event_loop.rs:211:5
  13: dioxus_desktop::launch::launch_virtual_dom_blocking
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dioxus-desktop-0.6.0/src/launch.rs:19:5
  14: dioxus_desktop::launch::launch_virtual_dom::{{closure}}
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dioxus-desktop-0.6.0/src/launch.rs:123:17
  15: <tokio::task::unconstrained::Unconstrained<F> as core::future::future::Future>::poll::{{closure}}
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.42.0/src/task/unconstrained.rs:25:57
  16: tokio::runtime::coop::with_budget
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.42.0/src/runtime/coop.rs:107:5
  17: tokio::runtime::coop::with_unconstrained
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.42.0/src/runtime/coop.rs:80:5
  18: <tokio::task::unconstrained::Unconstrained<F> as core::future::future::Future>::poll
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.42.0/src/task/unconstrained.rs:25:13
  19: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.42.0/src/runtime/park.rs:281:63
  20: tokio::runtime::coop::with_budget
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.42.0/src/runtime/coop.rs:107:5
  21: tokio::runtime::coop::budget
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.42.0/src/runtime/coop.rs:73:5
  22: tokio::runtime::park::CachedParkThread::block_on
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.42.0/src/runtime/park.rs:281:31
  23: tokio::runtime::context::blocking::BlockingRegionGuard::block_on
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.42.0/src/runtime/context/blocking.rs:66:9
  24: tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.42.0/src/runtime/scheduler/multi_thread/mod.rs:87:13
  25: tokio::runtime::context::runtime::enter_runtime
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.42.0/src/runtime/context/runtime.rs:65:16
  26: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.42.0/src/runtime/scheduler/multi_thread/mod.rs:86:9
  27: tokio::runtime::runtime::Runtime::block_on_inner
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.42.0/src/runtime/runtime.rs:370:45
  28: tokio::runtime::runtime::Runtime::block_on
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.42.0/src/runtime/runtime.rs:342:13
  29: dioxus_desktop::launch::launch_virtual_dom
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dioxus-desktop-0.6.0/src/launch.rs:118:9
  30: dioxus_desktop::launch::launch
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dioxus-desktop-0.6.0/src/launch.rs:152:5
  31: dioxus::launch::LaunchBuilder::desktop::{{closure}}
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dioxus-0.6.0/src/launch.rs:66:46
  32: core::ops::function::FnOnce::call_once
             at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/ops/function.rs:250:5
  33: dioxus::launch::LaunchBuilder::launch_inner
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dioxus-0.6.0/src/launch.rs:181:9
  34: dioxus::launch::LaunchBuilder::launch
             at /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dioxus-0.6.0/src/launch.rs:186:9
  35: mailrs::main
             at ./src/main.rs:22:5
  36: core::ops::function::FnOnce::call_once
             at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@jkelleyrtp jkelleyrtp added this to the 0.6.2 milestone Jan 7, 2025
@jkelleyrtp jkelleyrtp added bug Something isn't working cli Related to the dioxus-cli program labels Jan 7, 2025
@jkelleyrtp jkelleyrtp changed the title Generated dx-init code crashes Panic in window resume unwrap assuming a monitor exists Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli Related to the dioxus-cli program
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants