Godot crashes when recompiling gdext and reloading scene while signal connected
- Dominant language
- Rust
- Stars
- 5.2k
- Forks
- 312
- Avg merge
- 11h 10m
- Merged PRs (30d)
- 10
Description
Add the following node to scene and at this point scene reloading works fine. However, once you recompile gdext and then reload the scene, Godot will crash.
```rust
#[derive(GodotClass)]
#[class(base=Node3D,tool,init)]
struct MyNode3D {
base: Base,
}
#[godot_api]
impl INode3D for MyNode3D {
fn ready(&mut self) {
self.signals().visibility_changed().connect_self(|this| {
let is_visible = this.base().is_visible();
godot_print!("visibility: {}", is_visible);
});
}
```
Call stack:
```
7F178031BE90 (Unknown Source:0)
CallableCustomExtension::~CallableCustomExtension() (/home/luo/godot/core/extension/gdextension_interface.cpp:232)
void memdelete(CallableCustom*) (/home/luo/godot/core/os/memory.h:139)
Callable::~Callable() (/home/luo/godot/core/variant/callable.cpp:442)
KeyValue::~KeyValue() (/home/luo/godot/core/templates/pair.h:64)
HashMapElement::~HashMapElement() (/home/luo/godot/core/templates/hash_map.h:55)
void memdelete>(HashMapElement*) (/home/luo/godot/core/os/memory.h:139)
DefaultTypedAllocator>::delete_allocation(HashMapElement*) (/home/luo/godot/core/os/memory.h:258)
HashMap, HashMapComparatorDefault, DefaultTypedAllocator>>::clear() (/home/luo/godot/core/templates/hash_map.h:257)
HashMap, HashMapComparatorDefault, DefaultTypedAllocator>>::~HashMap() (/home/luo/godot/core/templates/hash_map.h:641)
Object::SignalData::~SignalData() (/home/luo/godot/core/object/object.h:613)
KeyValue::~KeyValue() (/home/luo/godot/core/templates/pair.h:64)
HashMapElement::~HashMapElement() (/home/luo/godot/core/templates/hash_map.h:55)
void memdelete>(HashMapElement*) (/home/luo/godot/core/os/memory.h:139)
DefaultTypedAllocator>::delete_allocation(HashMapElement*) (/home/luo/godot/core/os/memory.h:258)
HashMap, DefaultTypedAllocator>>::erase(StringName const&) (/home/luo/godot/core/templates/hash_map.h:356)
Object::~Object() (/home/luo/godot/core/object/object.cpp:2290)
Node::~Node() (/home/luo/godot/scene/main/node.cpp:4083)
Node3D::~Node3D() (/home/luo/godot/scene/3d/node_3d.cpp:1555)
void memdelete(Node*) (/home/luo/godot/core/os/memory.h:139)
```
Contributor guide
Research direction
Reproduce the crash with the provided Rust MyNode3D signal connection, then inspect the cleanup path starting at CallableCustomExtension::~CallableCustomExtension() in core/extension/gdextension_interface.cpp and the signal destruction frames listed in the call stack. Done means recompiling gdext and reloading the scene no longer crashes when the visibility_changed connection is cleaned up.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- godot, rust
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100