godotengine / godotengine/godot-cpp
Editor crashes on shutdown when fetching a singleton via Engine
- Dominant language
- C++
- Stars
- 2.7k
- Forks
- 809
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 8
Description
### Godot version
4.6.beta2
### godot-cpp version
4.5.0.stable sync and b724219737883e311f4cc4da1b49a0960dd00d38
### System information
Windows 11. I should note that on Linux, I do not observe this behavior, and unfortunately, I do not have a MacOS system to verify whether this problem exists there or not.
### Issue description
When using the following logic in an empty GDExtension:
```
void initialize_extension_module(ModuleInitializationLevel p_level) {
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
for (const String& singleton_name : Engine::get_singleton()->get_singleton_list()) {
Object* o = Engine::get_singleton()->get_singleton(singleton_name);
}
}
}
```
On Windows, when the editor closes, this leads to
```
[0]
[1] Object::~Object (core\object\object.cpp:2436)
[2] GDExtensionManager::`scalar deleting destructor`
[3] unregister_core_types (core\register_core_types.cpp:427)
[4] Main::cleanup (main\main.cpp:5229)
[5] widechar_main (platform\windows\godot_windows.cpp:105)
[6] _main (platform\windows\godot_windows.cpp:128)
[7] main (platform\windows\godot_windows.cpp:140)
```
### Steps to reproduce
See code snippet above.
### Minimal reproduction project
N/A
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.