iced-rs / iced

A cross-platform GUI library for Rust, inspired by Elm
https://iced.rs
MIT License
24.71k stars 1.16k forks source link

Pokedex example crashes when the window is resized to 0 height #271

Open pantsman0 opened 4 years ago

pantsman0 commented 4 years ago

I just checked out the repo to give it a look, and I was trying some of the examples.

I ran the Pokedex example on Windows 10 Pro (10.0.18362 N/A Build 18362) and it was running great... until I resized the windows so it had 0 height.

It crashes on the error thread 'main' panicked at 'calledResult::unwrap()on anErrvalue: OutOfMemory(Host)', C:\Users\pants\.cargo\registry\src\github.com-1ecc6299db9ec823\wgpu-native-0.4.3\src\device.rs:2091:9.

jfro commented 4 years ago

seeing this when minimizing an iced window on hybrid GPU systems like laptops. Doesn't happen on discrete GPU system like my tower.

jdswensen commented 4 years ago

I was able to reproduce this today. Some PCs I tested on crashed, some did not. The ones that did crash both use hybrid graphics.

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: OutOfMemory(Host)', C:\Users\jake\.cargo\registry\src\github.com-1ecc6299db9ec823\wgpu-native-0.4.3\src\device.rs:2091:9
stack backtrace:
   0: backtrace::backtrace::trace_unsynchronized
             at C:\Users\VssAdministrator\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.46\src\backtrace\mod.rs:66
   1: std::sys_common::backtrace::_print_fmt
             at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7\/src\libstd\sys_common\backtrace.rs:78
   2: std::sys_common::backtrace::_print::{{impl}}::fmt
             at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7\/src\libstd\sys_common\backtrace.rs:59
   3: core::fmt::write
             at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7\/src\libcore\fmt\mod.rs:1069
   4: std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
             at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7\/src\libstd\io\mod.rs:1504
   5: std::sys_common::backtrace::_print
             at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7\/src\libstd\sys_common\backtrace.rs:62
   6: std::sys_common::backtrace::print
             at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7\/src\libstd\sys_common\backtrace.rs:49
   7: std::panicking::default_hook::{{closure}}
             at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7\/src\libstd\panicking.rs:198
   8: std::panicking::default_hook
             at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7\/src\libstd\panicking.rs:218
   9: std::panicking::rust_panic_with_hook
             at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7\/src\libstd\panicking.rs:511
  10: std::panicking::begin_panic_handler
             at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7\/src\libstd\panicking.rs:419
  11: core::panicking::panic_fmt
             at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7\/src\libcore\panicking.rs:111
  12: core::option::expect_none_failed
             at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7\/src\libcore\option.rs:1268
  13: wgpu_device_create_swap_chain
  14: <iced_wgpu::window::backend::Backend as iced_native::window::backend::Backend>::create_swap_chain
  15: alloc::collections::vec_deque::VecDeque<T>::wrap_copy
  16: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  17: winit::platform_impl::platform::event_loop::runner::EventLoopRunner<T>::call_event_handler
  18: winit::platform_impl::platform::event_loop::runner::EventLoopRunner<T>::send_event
  19: winit::platform_impl::platform::event_loop::public_window_callback::{{closure}}
  20: winit::platform_impl::platform::event_loop::runner::EventLoopRunner<T>::catch_unwind
  21: winit::platform_impl::platform::event_loop::public_window_callback
  22: DefSubclassProc
  23: DefSubclassProc
  24: CallWindowProcW
  25: CallWindowProcW
  26: glPushClientAttrib
  27: CallWindowProcW
  28: DispatchMessageW
  29: IsWindowVisible
  30: KiUserCallbackDispatcher
  31: NtUserDispatchMessage
  32: DispatchMessageW
  33: winit::platform_impl::platform::event_loop::runner::EventLoopRunner<T>::owned_windows
  34: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  35: winit::platform_impl::platform::event_loop::runner::EventLoopRunner<T>::catch_unwind
  36: winit::platform_impl::platform::event_loop::EventLoopThreadExecutor::execute_in_thread
  37: DefSubclassProc
  38: DefSubclassProc
  39: CallWindowProcW
  40: DispatchMessageW
  41: IsWindowVisible
  42: KiUserCallbackDispatcher
  43: NtUserDispatchMessage
  44: DispatchMessageW
  45: winit::platform_impl::platform::event_loop::EventLoop<T>::run
  46: tokio::runtime::blocking::pool::spawn_blocking
  47: iced_winit::application::Application::run
  48: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  49: futures_channel::mpsc::unbounded
  50: std::rt::lang_start_internal::{{closure}}
             at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7\/src\libstd\rt.rs:52
  51: std::panicking::try::do_call
             at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7\/src\libstd\panicking.rs:331
  52: std::panicking::try
             at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7\/src\libstd\panicking.rs:274
  53: std::panic::catch_unwind
             at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7\/src\libstd\panic.rs:394
  54: std::rt::lang_start_internal
             at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7\/src\libstd\rt.rs:51
  55: main
  56: invoke_main
             at d:\agent\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  57: __scrt_common_main_seh
             at d:\agent\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  58: BaseThreadInitThunk
  59: RtlUserThreadStart
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: process didn't exit successfully: `target\release\test-gui.exe` (exit code: 101)
kurnevsky commented 4 years ago

I can reproduce it on both discrete and integrated GPU. I use linux with mesa.

eternal-io commented 3 years ago

Hmm... almost a year passed, how could i avoid this crash?