Skip to content

Panic + abort when overriding property list on MeshLibrary #1668

Description

@CenTdemeern1

The following code hard crashes the editor when added to a GridMap:

use godot::{
    classes::{IMeshLibrary, MeshLibrary},
    prelude::*,
    register::info::PropertyInfo,
};

#[derive(GodotClass)]
#[class(base=MeshLibrary, init, tool)]
pub struct CrashingMeshLibrary {
    base: Base<MeshLibrary>,
}

#[godot_api]
impl IMeshLibrary for CrashingMeshLibrary {
    fn on_get_property_list(&mut self) -> Vec<PropertyInfo> {
        vec![]
    }
}

...but only when it's in a submodule, or something...? This bug is kind of weird and tends to disappear when studied

I can reproduce it with the following project when launching Godot via the command line:
reset; RUST_BACKTRACE=1 ./Godot /Users/centdemeern1/Documents/GodotProjects/meshlibrary-repro/Godot/project.godot
meshlibrary-repro.zip

Log and backtrace
Initialize godot-rust (API v4.7.stable.official, runtime v4.7.1.stable.official, safeguards strict)
Godot Engine v4.7.1.stable.official.a13da4feb - https://godotengine.org
Metal 4.0 - Forward+ - Using Device #0: Apple - Apple M4 (Apple9)


[backtrace of previous `bind_mut` borrow]
   0: std::backtrace_rs::backtrace::libunwind::trace
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/std/src/../../backtrace/src/backtrace/libunwind.rs:117:9
   1: std::backtrace_rs::backtrace::trace_unsynchronized::<<std::backtrace::Backtrace>::create::{closure#0}>
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/std/src/../../backtrace/src/backtrace/mod.rs:66:14
   2: <std::backtrace::Backtrace>::create
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/std/src/backtrace.rs:331:13
   3: <godot_core::storage::borrow_info::DebugBorrowTracker>::track_mut_borrow
             at /Users/centdemeern1/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/godot-core-0.5.4/src/storage/mod.rs:175:28
   4: <godot_core::storage::single_threaded::InstanceStorage<meshlibrary_repro::module::crashing_meshlibrary::CrashingMeshLibrary> as godot_core::storage::instance_storage::Storage>::get_mut
             at /Users/centdemeern1/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/godot-core-0.5.4/src/storage/single_threaded.rs:78:29
   5: <godot_core::storage::instance_storage::RecvMut as godot_core::storage::instance_storage::IntoVirtualMethodReceiver<meshlibrary_repro::module::crashing_meshlibrary::CrashingMeshLibrary>>::instance
             at /Users/centdemeern1/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/godot-core-0.5.4/src/storage/instance_storage.rs:213:60
   6: godot_core::registry::callbacks::get_property_list::<meshlibrary_repro::module::crashing_meshlibrary::CrashingMeshLibrary>
             at /Users/centdemeern1/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/godot-core-0.5.4/src/registry/callbacks.rs:352:20


[panic /Users/centdemeern1/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/godot-core-0.5.4/src/storage/mod.rs:38]
  Gd<T>::bind_mut() failed, already bound; T = meshlibrary_repro::module::crashing_meshlibrary::CrashingMeshLibrary.
    Make sure to use `self.base_mut()` instead of `self.to_gd()` when possible.
    Details: cannot borrow while accessible mutable borrow exists.

[panic backtrace]
   0: std::backtrace_rs::backtrace::libunwind::trace
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/std/src/../../backtrace/src/backtrace/libunwind.rs:117:9
   1: std::backtrace_rs::backtrace::trace_unsynchronized::<<std::backtrace::Backtrace>::create::{closure#0}>
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/std/src/../../backtrace/src/backtrace/mod.rs:66:14
   2: <std::backtrace::Backtrace>::create
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/std/src/backtrace.rs:331:13
   3: godot_core::private::set_gdext_hook::<godot_core::init::__gdext_load_library<meshlibrary_repro::ReproExtension>::{closure#0}::{closure#0}>::{closure#0}
             at /Users/centdemeern1/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/godot-core-0.5.4/src/private.rs:310:44
   4: <alloc::boxed::Box<dyn for<'a, 'b> core::ops::function::Fn<(&'a std::panic::PanicHookInfo<'b>,), Output = ()> + core::marker::Sync + core::marker::Send> as core::ops::function::Fn<(&std::panic::PanicHookInfo,)>>::call
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/alloc/src/boxed.rs:2289:9
   5: std::panicking::panic_with_hook
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/std/src/panicking.rs:833:13
   6: std::panicking::panic_handler::{closure#0}
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/std/src/panicking.rs:698:13
   7: std::sys::backtrace::__rust_end_short_backtrace::<std::panicking::panic_handler::{closure#0}, !>
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/std/src/sys/backtrace.rs:182:18
   8: __rustc::rust_begin_unwind
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/std/src/panicking.rs:689:5
   9: core::panicking::panic_fmt
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/core/src/panicking.rs:80:14
  10: godot_core::storage::bind_mut_failed::<meshlibrary_repro::module::crashing_meshlibrary::CrashingMeshLibrary>
             at /Users/centdemeern1/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/godot-core-0.5.4/src/storage/mod.rs:38:5
  11: <godot_core::storage::single_threaded::InstanceStorage<meshlibrary_repro::module::crashing_meshlibrary::CrashingMeshLibrary> as godot_core::storage::instance_storage::Storage>::get_mut::{closure#0}
             at /Users/centdemeern1/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/godot-core-0.5.4/src/storage/single_threaded.rs:76:33
  12: <core::result::Result<godot_cell::guards::MutGuard<meshlibrary_repro::module::crashing_meshlibrary::CrashingMeshLibrary>, alloc::boxed::Box<dyn core::error::Error>>>::unwrap_or_else::<<godot_core::storage::single_threaded::InstanceStorage<meshlibrary_repro::module::crashing_meshlibrary::CrashingMeshLibrary> as godot_core::storage::instance_storage::Storage>::get_mut::{closure#0}>
             at /Users/centdemeern1/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/result.rs:1622:23
  13: <godot_core::storage::single_threaded::InstanceStorage<meshlibrary_repro::module::crashing_meshlibrary::CrashingMeshLibrary> as godot_core::storage::instance_storage::Storage>::get_mut
             at /Users/centdemeern1/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/godot-core-0.5.4/src/storage/single_threaded.rs:76:14
  14: <godot_core::storage::instance_storage::RecvMut as godot_core::storage::instance_storage::IntoVirtualMethodReceiver<meshlibrary_repro::module::crashing_meshlibrary::CrashingMeshLibrary>>::instance
             at /Users/centdemeern1/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/godot-core-0.5.4/src/storage/instance_storage.rs:213:60
  15: godot_core::registry::callbacks::get_property_list::<meshlibrary_repro::module::crashing_meshlibrary::CrashingMeshLibrary>
             at /Users/centdemeern1/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/godot-core-0.5.4/src/registry/callbacks.rs:352:20


[panic /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/core/src/panicking.rs:225]  panic in a function that cannot unwind

[panic backtrace]
   0: std::backtrace_rs::backtrace::libunwind::trace
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/std/src/../../backtrace/src/backtrace/libunwind.rs:117:9
   1: std::backtrace_rs::backtrace::trace_unsynchronized::<<std::backtrace::Backtrace>::create::{closure#0}>
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/std/src/../../backtrace/src/backtrace/mod.rs:66:14
   2: <std::backtrace::Backtrace>::create
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/std/src/backtrace.rs:331:13
   3: godot_core::private::set_gdext_hook::<godot_core::init::__gdext_load_library<meshlibrary_repro::ReproExtension>::{closure#0}::{closure#0}>::{closure#0}
             at /Users/centdemeern1/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/godot-core-0.5.4/src/private.rs:310:44
   4: <alloc::boxed::Box<dyn for<'a, 'b> core::ops::function::Fn<(&'a std::panic::PanicHookInfo<'b>,), Output = ()> + core::marker::Sync + core::marker::Send> as core::ops::function::Fn<(&std::panic::PanicHookInfo,)>>::call
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/alloc/src/boxed.rs:2289:9
   5: std::panicking::panic_with_hook
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/std/src/panicking.rs:833:13
   6: std::panicking::panic_handler::{closure#0}
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/std/src/panicking.rs:691:13
   7: std::sys::backtrace::__rust_end_short_backtrace::<std::panicking::panic_handler::{closure#0}, !>
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/std/src/sys/backtrace.rs:182:18
   8: __rustc::rust_begin_unwind
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/std/src/panicking.rs:689:5
   9: core::panicking::panic_nounwind_fmt::runtime
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/core/src/panicking.rs:122:22
  10: core::panicking::panic_nounwind_fmt
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/core/src/intrinsics/mod.rs:2450:9
  11: core::panicking::panic_nounwind
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/core/src/panicking.rs:225:5
  12: core::panicking::panic_cannot_unwind
             at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/core/src/panicking.rs:337:5
  13: godot_core::registry::callbacks::get_property_list::<meshlibrary_repro::module::crashing_meshlibrary::CrashingMeshLibrary>
             at /Users/centdemeern1/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/godot-core-0.5.4/src/registry/callbacks.rs:346:1


thread caused non-unwinding panic. aborting.
zsh: abort      RUST_BACKTRACE=1 ./Godot

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions