Skip to content

Closing the window causes panic in 2D #4678

Closed
@infmagic2047

Description

@infmagic2047

Bevy version

Main (happens after #3575).

Operating system & version

Gentoo Linux with x11.

What you did

Run one of the 2D examples (like the breakout example), and close the window.

What you expected to happen

Game quits cleanly.

What actually happened

thread 'main' panicked at 'view entity should exist: QueryDoesNotMatch(0v0)', crates/bevy_core_pipeline/src/main_pass_2d.rs:45:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Additional information

3D examples seems unaffected.

When running the multiple windows example and closing one of the windows, these lines are logged, while there were no such logging before #3575. They may be related to the crash here.

2022-05-06T17:31:03.091662Z  INFO bevy_winit: Skipped event for closed window: WindowId(5bc720ad-b557-4ad2-8cd7-f1cfff34214c)
2022-05-06T17:31:03.091713Z  INFO bevy_winit: Skipped event for closed window: WindowId(5bc720ad-b557-4ad2-8cd7-f1cfff34214c)
2022-05-06T17:31:03.091735Z  INFO bevy_winit: Skipped event for closed window: WindowId(5bc720ad-b557-4ad2-8cd7-f1cfff34214c)
2022-05-06T17:31:03.091829Z  INFO bevy_winit: Skipped event for closed window: WindowId(5bc720ad-b557-4ad2-8cd7-f1cfff34214c)
2022-05-06T17:31:03.091866Z  INFO bevy_winit: Skipped event for closed window: WindowId(5bc720ad-b557-4ad2-8cd7-f1cfff34214c)

Complete backtrace of the crash:

thread 'main' panicked at 'view entity should exist: QueryDoesNotMatch(0v0)', crates/bevy_core_pipeline/src/main_pass_2d.rs:45:14
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: core::result::Result<T,E>::expect
             at /rustc/1.60.0/library/core/src/result.rs:1022:23
   4: <bevy_core_pipeline::main_pass_2d::MainPass2dNode as bevy_render::render_graph::node::Node>::run
             at ./crates/bevy_core_pipeline/src/main_pass_2d.rs:42:43
   5: bevy_render::renderer::graph_runner::RenderGraphRunner::run_graph
             at ./crates/bevy_render/src/renderer/graph_runner.rs:175:21
   6: bevy_render::renderer::graph_runner::RenderGraphRunner::run_graph
             at ./crates/bevy_render/src/renderer/graph_runner.rs:182:21
   7: bevy_render::renderer::graph_runner::RenderGraphRunner::run
             at ./crates/bevy_render/src/renderer/graph_runner.rs:60:9
   8: bevy_render::renderer::render_system
             at ./crates/bevy_render/src/renderer/mod.rs:26:21
   9: core::ops::function::FnMut::call_mut
             at /rustc/1.60.0/library/core/src/ops/function.rs:150:5
  10: <bevy_ecs::system::exclusive_system::ExclusiveSystemFn<F> as bevy_ecs::system::exclusive_system::ExclusiveSystem>::run
             at ./crates/bevy_ecs/src/system/exclusive_system.rs:37:9
  11: <bevy_ecs::schedule::stage::SystemStage as bevy_ecs::schedule::stage::Stage>::run
             at ./crates/bevy_ecs/src/schedule/stage.rs:891:25
  12: <bevy_render::RenderPlugin as bevy_app::plugin::Plugin>::build::{{closure}}
             at ./crates/bevy_render/src/lib.rs:262:21
  13: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/1.60.0/library/alloc/src/boxed.rs:1867:9
  14: bevy_app::app::App::update
             at ./crates/bevy_app/src/app.rs:116:13
  15: bevy_winit::winit_runner_with::{{closure}}
             at ./crates/bevy_winit/src/lib.rs:565:21
  16: winit::platform_impl::platform::sticky_exit_callback
             at <redacted>/winit-0.26.1/src/platform_impl/linux/mod.rs:753:5
  17: winit::platform_impl::platform::x11::EventLoop<T>::run_return
             at <redacted>/winit-0.26.1/src/platform_impl/linux/x11/mod.rs:293:17
  18: winit::platform_impl::platform::x11::EventLoop<T>::run
             at <redacted>/winit-0.26.1/src/platform_impl/linux/x11/mod.rs:392:9
  19: winit::platform_impl::platform::EventLoop<T>::run
             at <redacted>/winit-0.26.1/src/platform_impl/linux/mod.rs:669:56
  20: winit::event_loop::EventLoop<T>::run
             at <redacted>/winit-0.26.1/src/event_loop.rs:154:9
  21: bevy_winit::run
             at ./crates/bevy_winit/src/lib.rs:195:5
  22: bevy_winit::winit_runner_with
             at ./crates/bevy_winit/src/lib.rs:606:9
  23: bevy_winit::winit_runner
             at ./crates/bevy_winit/src/lib.rs:235:5
  24: core::ops::function::Fn::call
             at /rustc/1.60.0/library/core/src/ops/function.rs:70:5
  25: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/1.60.0/library/alloc/src/boxed.rs:1867:9
  26: bevy_app::app::App::run
             at ./crates/bevy_app/src/app.rs:130:9
  27: breakout::main
             at ./examples/games/breakout.rs:56:5
  28: core::ops::function::FnOnce::call_once
             at /rustc/1.60.0/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenC-BugAn unexpected or incorrect behaviorP-CrashA sudden unexpected crashS-DuplicateThis issue or PR already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions