Repository navigation
panic when running example multiple_windows #1069
Copy link
Copy link
Closed
Labels
A-WindowingPlatform-agnostic interface layer to run your app inPlatform-agnostic interface layer to run your app inI-CrashA sudden unexpected crashA sudden unexpected crashO-MacOSSpecific to the MacOS (Apple) desktop operating systemSpecific to the MacOS (Apple) desktop operating system
Description
Bevy version
Operating system & version
macOS 10.15.7
What you did
run example multiple_windows
cargo run --example multiple_windows
Finished dev [unoptimized + debuginfo] target(s) in 0.61s
Running `target/debug/examples/multiple_windows`
thread 'main' panicked at 'Received window resized event for non-existent window.', crates/bevy_render/src/render_graph/nodes/window_swapchain_node.rs:52:14
stack backtrace:
0: rust_begin_unwind
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
1: core::panicking::panic_fmt
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/panicking.rs:85
2: core::option::expect_failed
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/option.rs:1226
3: core::option::Option<T>::expect
at /Users/francois/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/option.rs:346
4: <bevy_render::render_graph::nodes::window_swapchain_node::WindowSwapChainNode as bevy_render::render_graph::node::Node>::update
at ./crates/bevy_render/src/render_graph/nodes/window_swapchain_node.rs:50
5: bevy_wgpu::renderer::wgpu_render_graph_executor::WgpuRenderGraphExecutor::execute
at ./crates/bevy_wgpu/src/renderer/wgpu_render_graph_executor.rs:73
6: bevy_wgpu::wgpu_renderer::WgpuRenderer::run_graph
at ./crates/bevy_wgpu/src/wgpu_renderer.rs:103
7: bevy_wgpu::wgpu_renderer::WgpuRenderer::update
at ./crates/bevy_wgpu/src/wgpu_renderer.rs:114
8: bevy_wgpu::get_wgpu_render_system::{{closure}}
at ./crates/bevy_wgpu/src/lib.rs:41
9: bevy_ecs::system::into_thread_local::<impl bevy_ecs::system::into_system::IntoSystem<(&mut bevy_ecs::core::world::World,&mut bevy_ecs::resource::resources::Resources),bevy_ecs::system::into_thread_local::ThreadLocalSystemFn> for F>::system::{{closure}}
at ./crates/bevy_ecs/src/system/into_thread_local.rs:65
10: <alloc::boxed::Box<F> as core::ops::function::FnMut<A>>::call_mut
at /Users/francois/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1049
11: <bevy_ecs::system::into_thread_local::ThreadLocalSystemFn as bevy_ecs::system::system::System>::run_thread_local
at ./crates/bevy_ecs/src/system/into_thread_local.rs:49
12: <bevy_ecs::schedule::stage_executor::ParallelSystemStageExecutor as bevy_ecs::schedule::stage_executor::SystemStageExecutor>::execute_stage
at ./crates/bevy_ecs/src/schedule/stage_executor.rs:481
13: bevy_ecs::schedule::stage::SystemStage::run_once
at ./crates/bevy_ecs/src/schedule/stage.rs:117
14: <bevy_ecs::schedule::stage::SystemStage as bevy_ecs::schedule::stage::Stage>::run
at ./crates/bevy_ecs/src/schedule/stage.rs:151
15: bevy_ecs::schedule::Schedule::run_once
at ./crates/bevy_ecs/src/schedule/mod.rs:162
16: <bevy_ecs::schedule::Schedule as bevy_ecs::schedule::stage::Stage>::run
at ./crates/bevy_ecs/src/schedule/mod.rs:202
17: bevy_ecs::schedule::Schedule::initialize_and_run
at ./crates/bevy_ecs/src/schedule/mod.rs:169
18: bevy_app::app::App::update
at ./crates/bevy_app/src/app.rs:56
19: bevy_winit::winit_runner::{{closure}}
at ./crates/bevy_winit/src/lib.rs:363
20: <alloc::boxed::Box<F> as core::ops::function::FnMut<A>>::call_mut
at /Users/francois/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1049
21: <winit::platform_impl::platform::app_state::EventLoopHandler<T> as winit::platform_impl::platform::app_state::EventHandler>::handle_nonuser_event
at /Users/francois/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/macos/app_state.rs:71
22: winit::platform_impl::platform::app_state::Handler::handle_nonuser_event
at /Users/francois/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/macos/app_state.rs:173
23: winit::platform_impl::platform::app_state::AppState::cleared
at /Users/francois/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/macos/app_state.rs:331
24: winit::platform_impl::platform::observer::control_flow_end_handler
at /Users/francois/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/macos/observer.rs:135
25: ___CFRunLoopRun
26: ___CFRunLoopRun
27: _CFRunLoopRunSpecific
28: _____kCFPasteboardFilenamesFlavor_block_invoke
29: _RunCurrentEventLoopInMode
30: _ReceiveNextEventCommon
31: __BlockUntilNextEventMatchingListInModeWithFilter
32: __DPSNextEvent
33: -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
34: -[NSApplication run]
35: <() as objc::message::MessageArguments>::invoke
at /Users/francois/.cargo/registry/src/github.com-1ecc6299db9ec823/objc-0.2.7/src/message/mod.rs:128
36: objc::message::platform::send_unverified
at /Users/francois/.cargo/registry/src/github.com-1ecc6299db9ec823/objc-0.2.7/src/message/apple/mod.rs:27
37: objc::message::send_message
at /Users/francois/.cargo/registry/src/github.com-1ecc6299db9ec823/objc-0.2.7/src/message/mod.rs:178
38: winit::platform_impl::platform::event_loop::EventLoop<T>::run_return
at /Users/francois/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/macos/event_loop.rs:106
39: winit::platform_impl::platform::event_loop::EventLoop<T>::run
at /Users/francois/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/macos/event_loop.rs:93
40: winit::event_loop::EventLoop<T>::run
at /Users/francois/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/event_loop.rs:154
41: bevy_winit::run
at ./crates/bevy_winit/src/lib.rs:121
42: bevy_winit::winit_runner
at ./crates/bevy_winit/src/lib.rs:371
43: core::ops::function::Fn::call
at /Users/francois/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:70
44: <alloc::boxed::Box<F> as core::ops::function::Fn<A>>::call
at /Users/francois/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1056
45: bevy_app::app::App::run
at ./crates/bevy_app/src/app.rs:67
46: bevy_app::app_builder::AppBuilder::run
at ./crates/bevy_app/src/app_builder.rs:49
47: multiple_windows::main
at ./examples/window/multiple_windows.rs:17
48: core::ops::function::FnOnce::call_once
at /Users/francois/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:227
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
What you expected to happen
the example shouldn't panic
What actually happened
it panicked
Additional information
commit 509b138 broke this example
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-WindowingPlatform-agnostic interface layer to run your app inPlatform-agnostic interface layer to run your app inI-CrashA sudden unexpected crashA sudden unexpected crashO-MacOSSpecific to the MacOS (Apple) desktop operating systemSpecific to the MacOS (Apple) desktop operating system
Activity
mockersf commentedon Dec 15, 2020
adding a few logs when calling
handle_create_window_events, received winit events, creating the second window andcalling WindowSwapChainNode.updatewe can see that event
MainEventsClearedis received, thenhandle_create_window_eventsis called, before the startup system runs and create the second windowmaybe look around #1021 (comment)
IngmarBitter commentedon Dec 15, 2020
bevy version 0.3.0, commit sha 51650f1 running on Windows 10 with NVida GTX 3090 I get the same:
thread 'main' panicked at 'Received window resized event for non-existent window.', crates\bevy_render\src\render_graph\nodes\window_swapchain_node.rs:52:14blunted2night commentedon Dec 16, 2020
I think this is due to PR #1033 that changes how window creation is done. Now the bevy window is not added until after the underlying OS window is created. I know in MS Windows that a number of messages are dispatched during window creation, including a WM_SIZE, which if allowed to make it all the way would produce this behavior.
blunted2night commentedon Dec 16, 2020
Never-mind, it was introduced in #1021 (509b138)