Skip to content

Panic when using min_size on Window #455

@EbonJaeger

Description

@EbonJaeger

Describe the bug
When using the min_size function when building a Window, the application panics with:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/emaddock/.cargo/git/checkouts/orbtk-90d798f349c2ab56/4479802/orbtk_tinyskia/src/tinyskia/mod.rs:50:63

To Reproduce
Steps to reproduce the behavior:

  1. Generate a new project using the OrbTK template
  2. Add a call to min_size(325.0, 500.0) when building the Window in main.rs
  3. Run cargo run
  4. See error

Expected behavior
The application should run and have a minimum size.

Desktop (please complete the following information):

  • OS: Solus 4.3 Fortitude
  • Browser: Vivaldi, though this isn't a web app.
  • Rust version: 1.55.0

Additional context
Here is the full backtrace with cargo run:

    Finished dev [optimized + debuginfo] target(s) in 0.08s
     Running `target/debug/calculator`
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/emaddock/.cargo/git/checkouts/orbtk-90d798f349c2ab56/4479802/orbtk_tinyskia/src/tinyskia/mod.rs:50:63
stack backtrace:
   0: rust_begin_unwind
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:515:5
   1: core::panicking::panic_fmt
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/panicking.rs:50:5
   3: core::option::Option<T>::unwrap
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/option.rs:722:21
   4: orbtk_tinyskia::tinyskia::RenderContext2D::new
             at /home/emaddock/.cargo/git/checkouts/orbtk-90d798f349c2ab56/4479802/orbtk_tinyskia/src/tinyskia/mod.rs:50:22
   5: orbtk_orbclient::orbclient::window_builder::WindowBuilder<A>::build
             at /home/emaddock/.cargo/git/checkouts/orbtk-90d798f349c2ab56/4479802/orbtk_orbclient/src/orbclient/window_builder.rs:103:34
   6: orbtk::application::Application::window
             at /home/emaddock/.cargo/git/checkouts/orbtk-90d798f349c2ab56/4479802/orbtk/src/application.rs:71:9
   7: calculator::main
             at ./src/main.rs:10:5
   8: core::ops::function::FnOnce::call_once
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

main.rs:

use orbtk::prelude::*;

pub use self::main_state::*;
pub use self::main_view::*;

mod main_state;
mod main_view;

fn main() {
    Application::from_name("calculator")
        .window(move |ctx| {
            Window::new()
                .title("Calculator")
                .position((100.0, 100.0))
                .min_size(325.0, 500.0) // Added this line
                .size(325.0, 500.0)
                .resizeable(true)
                .child(MainView::new().title("Hello OrbTk").build(ctx))
                .build(ctx)
        })
        .run();
}

All other files in the project remain unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions