Skip to content

Panic when quit bevy application #17307

@AllenDang

Description

@AllenDang

Bevy version

0.15.1

[Optional] Relevant system information

cargo 1.84.0 (66221abde 2024-11-19)
macOS 15.2

What you did

Create a bevy application with following code

use std::time::Duration;

use bevy::{prelude::*, winit::WinitSettings};

fn main() {
    App::new()
        .insert_resource(WinitSettings {
            focused_mode: bevy::winit::UpdateMode::Continuous,
            unfocused_mode: bevy::winit::UpdateMode::reactive_low_power(Duration::from_secs(2)),
        })
        .add_plugins(DefaultPlugins.set(WindowPlugin {
            primary_window: Some(Window {
                title: "ImgBorad".into(),
                resolution: (1024., 768.).into(),
                ..default()
            }),
            ..default()
        }))
        .run();
}

fn setup(mut commands: Commands) {
    commands.spawn((
        Camera2d,
        systems::cam_control::CamStatus {
            target_scale: 1.0,
            current_scale: 1.0,
        },
    ));
}

And cargo run and cmd+q to exit.

What went wrong

Panic happened with following messages

warning: `img_board` (bin "img_board") generated 7 warnings (run `cargo fix --bin "img_board"` to apply 1 suggestion)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.72s
     Running `target/debug/img_board`
2025-01-11T09:56:28.215157Z  INFO bevy_render::renderer: AdapterInfo { name: "Apple M1 Max", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
2025-01-11T09:56:28.440264Z  INFO bevy_winit::system: Creating new window "ImgBorad" (0v1#4294967296)
2025-01-11 17:56:28.621 img_board[2469:45316179] +[IMKClient subclass]: chose IMKClient_Modern
2025-01-11 17:56:28.621 img_board[2469:45316179] +[IMKInputSession subclass]: chose IMKInputSession_Modern
thread 'main' panicked at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.15.1/src/system/system_param.rs:911:17:
Resource requested by (bevy_ecs::event::writer::EventWriter<bevy_window::event::WindowResized>, bevy_ecs::event::writer::EventWriter<bevy_window::event::WindowBackendScaleFactorChanged>, bevy_ecs::event::write
r::EventWriter<bevy_window::event::WindowScaleFactorChanged>, bevy_ecs::system::system_param::NonSend<bevy_winit::winit_windows::WinitWindows>, bevy_ecs::system::query::Query<(&mut bevy_window::window::Window,
 &mut bevy_winit::system::CachedWindow)>, bevy_ecs::change_detection::NonSendMut<bevy_winit::accessibility::AccessKitAdapters>) does not exist: bevy_ecs::event::collections::Events<bevy_window::event::WindowRe
sized>
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at core/src/panicking.rs:223:5:
panic in a function that cannot unwind
stack backtrace:
   0:        0x102c4403c - std::backtrace_rs::backtrace::libunwind::trace::h1577399c90b5d8c7
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:        0x102c4403c - std::backtrace_rs::backtrace::trace_unsynchronized::h1e626537f2a2dae5
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:        0x102c4403c - std::sys::backtrace::_print_fmt::hdfc6c57ce8e8814f
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/sys/backtrace.rs:66:9
   3:        0x102c4403c - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hadba1856081fe8dc
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/sys/backtrace.rs:39:26
   4:        0x102c6013c - core::fmt::rt::Argument::fmt::h2642ab69bd81711d
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/core/src/fmt/rt.rs:177:76
   5:        0x102c6013c - core::fmt::write::h5358bd20891469bc
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/core/src/fmt/mod.rs:1189:21
   6:        0x102c418b4 - std::io::Write::write_fmt::hbf0611cc5d72cc91
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/io/mod.rs:1884:15
   7:        0x102c43ef0 - std::sys::backtrace::BacktraceLock::print::he2302a8c253c9a13
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/sys/backtrace.rs:42:9
   8:        0x102c44e3c - std::panicking::default_hook::{{closure}}::hec1f77a77d7e7ffc
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:268:22
   9:        0x102c44c70 - std::panicking::default_hook::hdd59ab537dd27efb
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:295:9
  10:        0x102c4562c - std::panicking::rust_panic_with_hook::h533a16f5f89e4278
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:801:13
  11:        0x102c4527c - std::panicking::begin_panic_handler::{{closure}}::h168c3a4362c8e4df
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:667:13
  12:        0x102c44500 - std::sys::backtrace::__rust_end_short_backtrace::h601e3529ca2053df
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/sys/backtrace.rs:170:18
  13:        0x102c44f5c - rust_begin_unwind
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:665:5
  14:        0x102d627d4 - core::panicking::panic_nounwind_fmt::runtime::h95f46d78f27a07e2
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/core/src/panicking.rs:119:22
  15:        0x102d627d4 - core::panicking::panic_nounwind_fmt::h6251928767c378a3
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/core/src/intrinsics/mod.rs:3535:9
  16:        0x102d6284c - core::panicking::panic_nounwind::he5e0e92598e09d63
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/core/src/panicking.rs:223:5
  17:        0x102d629c4 - core::panicking::panic_cannot_unwind::hc39e9acf1ae7ca4b
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/core/src/panicking.rs:315:5
  18:        0x1002576d0 - winit::platform_impl::macos::window_delegate::WindowDelegate::window_will_close::h7415a9929420fcea
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/objc2-0.5.2/src/macros/declare_class.rs:981:25
  19:        0x19edfd360 - <unknown>
  20:        0x19ee8e20c - <unknown>
  21:        0x19ee8e154 - <unknown>
  22:        0x19edcbf9c - <unknown>
  23:        0x19ff85fd4 - <unknown>
  24:        0x1a346b95c - <unknown>
  25:        0x1a2bf3cbc - <unknown>
  26:        0x1a2c33c6c - <unknown>
  27:        0x19ee320cc - <unknown>
  28:        0x1a2b873fc - <unknown>
  29:        0x1a2b78e94 - <unknown>
  30:        0x1a2b11bfc - <unknown>
  31:        0x1a2bda200 - <unknown>
  32:        0x1a3301340 - <unknown>
  33:        0x1a315ba94 - <unknown>
  34:        0x1a2bd9254 - <unknown>
  35:        0x1a32d5e30 - <unknown>
  36:        0x1a32d3cc8 - <unknown>
  37:        0x100277494 - <(A,) as objc2::encode::EncodeArguments>::__invoke::hb7f3424ab473b95c
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/objc2-0.5.2/src/encode.rs:437:26
  38:        0x10022541c - objc2::runtime::message_receiver::msg_send_primitive::send_super::h4534c1e1f255b2a7
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/objc2-0.5.2/src/runtime/message_receiver.rs:193:18
  39:        0x100224d70 - objc2::runtime::message_receiver::MessageReceiver::send_super_message::h16cdcf1666f659dc
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/objc2-0.5.2/src/runtime/message_receiver.rs:477:33
  40:        0x10022ca5c - objc2::__macro_helpers::msg_send::MsgSend::send_super_message::hcdbdf55b914230b1
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/objc2-0.5.2/src/__macro_helpers/msg_send.rs:53:13
  41:        0x10022cb5c - objc2::__macro_helpers::msg_send::MsgSend::send_super_message_static::hee63d1d71295f7c0
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/objc2-0.5.2/src/__macro_helpers/msg_send.rs:71:18
  42:        0x100232d0c - winit::platform_impl::macos::app::WinitApplication::send_event::h054f992dd2b6b0fb
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.30.8/src/platform_impl/macos/app.rs:42:26
  43:        0x1a2edb4e8 - <unknown>
  44:        0x1a2964088 - <unknown>
  45:        0x100287678 - <() as objc2::encode::EncodeArguments>::__invoke::he1db3e4459aefe16
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/objc2-0.5.2/src/encode.rs:437:26
  46:        0x10028c140 - objc2::runtime::message_receiver::msg_send_primitive::send::hdfa2cec578ed839d
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/objc2-0.5.2/src/runtime/message_receiver.rs:173:18
  47:        0x100284484 - objc2::runtime::message_receiver::MessageReceiver::send_message::he176bd8765196de2
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/objc2-0.5.2/src/runtime/message_receiver.rs:433:38
  48:        0x1002747d8 - objc2::__macro_helpers::msg_send::MsgSend::send_message::h77d2b663aed0ea0e
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/objc2-0.5.2/src/__macro_helpers/msg_send.rs:27:31
  49:        0x100275070 - objc2_app_kit::generated::__NSApplication::NSApplication::run::h896607dca3788230
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/objc2-0.5.2/src/macros/extern_methods.rs:247:14
  50:        0x1000ebf24 - winit::platform_impl::macos::event_loop::EventLoop<T>::run_on_demand::{{closure}}::{{closure}}::hb2868bc705852b30
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.30.8/src/platform_impl/macos/event_loop.rs:303:26
  51:        0x1000d8b88 - objc2::rc::autorelease::autoreleasepool::hf8f219542ed0c287
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/objc2-0.5.2/src/rc/autorelease.rs:438:15
  52:        0x1000ebe70 - winit::platform_impl::macos::event_loop::EventLoop<T>::run_on_demand::{{closure}}::h324a27d7494b3d72
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.30.8/src/platform_impl/macos/event_loop.rs:289:13
  53:        0x100105374 - winit::platform_impl::macos::event_handler::EventHandler::set::hafca1b45eb139533
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.30.8/src/platform_impl/macos/event_handler.rs:98:9
  54:        0x1000b2fac - winit::platform_impl::macos::app_state::ApplicationDelegate::set_event_handler::h2a81d2c4a8494b38
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.30.8/src/platform_impl/macos/app_state.rs:191:9
  55:        0x1000ebe08 - winit::platform_impl::macos::event_loop::EventLoop<T>::run_on_demand::hda9941fd7f1f77e7
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.30.8/src/platform_impl/macos/event_loop.rs:288:9
  56:        0x1000ec420 - winit::platform_impl::macos::event_loop::EventLoop<T>::run::h4d7eca0dbc4f179f
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.30.8/src/platform_impl/macos/event_loop.rs:275:9
  57:        0x1000f6684 - winit::event_loop::EventLoop<T>::run_app::h799c5e3358ec6784
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.30.8/src/event_loop.rs:265:9
  58:        0x1000c7948 - bevy_winit::state::winit_runner::h63649269354547b9
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_winit-0.15.1/src/state.rs:862:23
  59:        0x1000c00e4 - core::ops::function::FnOnce::call_once::hd8cf37b41ffbe0b3
                               at /Users/allen/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  60:        0x1000bfea0 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hc5d1661ac56a638d
                               at /Users/allen/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  61:        0x1029b37ec - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h818191315d8355d8
                               at /Users/allen/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1972:9
  62:        0x1029ccdec - bevy_app::app::App::run::h52227b7081672e6d
                               at /Users/allen/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_app-0.15.1/src/app.rs:170:9
  63:        0x100096bd4 - img_board::main::hc54906fca3a8e523
                               at /Users/allen/Documents/RustProjects/img_board/src/main.rs:9:5
  64:        0x100092b64 - core::ops::function::FnOnce::call_once::hf93ff8f2eddccfe3
                               at /Users/allen/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  65:        0x10008fcd0 - std::sys::backtrace::__rust_begin_short_backtrace::h296f69868fb739c0
                               at /Users/allen/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs:154:18
  66:        0x1000971b8 - std::rt::lang_start::{{closure}}::h86c5c95447ec308b
                               at /Users/allen/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs:195:18
  67:        0x102c3d498 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h63129b5cef82c653
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/core/src/ops/function.rs:284:13
  68:        0x102c3d498 - std::panicking::try::do_call::hc75001ce68de17ce
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:557:40
  69:        0x102c3d498 - std::panicking::try::hca490467fa33fe9e
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:520:19
  70:        0x102c3d498 - std::panic::catch_unwind::h4c361f6b6fc783c6
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panic.rs:358:14
  71:        0x102c3d498 - std::rt::lang_start_internal::{{closure}}::hac41dc746758e783
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/rt.rs:174:48
  72:        0x102c3d498 - std::panicking::try::do_call::he06680f322313e18
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:557:40
  73:        0x102c3d498 - std::panicking::try::hcd65dba861b49988
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:520:19
  74:        0x102c3d498 - std::panic::catch_unwind::hbcff3448fe7d00ed
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panic.rs:358:14
  75:        0x102c3d498 - std::rt::lang_start_internal::hacda2dedffd2edb4
                               at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/rt.rs:174:20
  76:        0x100097184 - std::rt::lang_start::hda475fb24d432d74
                               at /Users/allen/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs:194:17
  77:        0x100096c8c - _main
thread caused non-unwinding panic. aborting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-WindowingPlatform-agnostic interface layer to run your app inC-BugAn unexpected or incorrect behaviorD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesO-MacOSSpecific to the MacOS (Apple) desktop operating systemP-RegressionFunctionality that used to work but no longer does. Add a test for this!S-Needs-TestingTesting must be done before this is safe to merge

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions