Editor crashes on shutdown when fetching a singleton via Engine
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start by reproducing the shutdown crash on Windows with the shown GDExtension logic, then read Object::~Object in core/object/object.cpp, unregister_core_types in core/register_core_types.cpp, and Main::cleanup in main/main.cpp. Compare the shutdown path with the singleton access and verify that the editor closes without the reported crash while preserving the Linux behavior.
Written by the indexing model from the issue text.
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] <couldn't map PC to fn name>
[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
- Dominant language
- C++
- Stars
- 2.7k
- Forks
- 813
- Avg merge
- 1h 31m
- Merged PRs (30d)
- 2
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from godotengine/godot-cpp
-
Building gdextensions with lto=full warns about serial compilatonPossibly taken @marcozee03 claimed this 32 days ago. Openenhancement topic:buildsystem
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
godotengine/godot-cpp#2002 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
godotengine/godot-cpp#1969 · 4 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
godotengine/godot-cpp#1967 ·
-
Hot reload decrements refcounted objects refcount, causing a crash.Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 50/100
godotengine/godot-cpp#2059 · 4 comments ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 50/100
godotengine/godot-cpp#2042 ·
All issues in godotengine/godot-cpp
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
EchoTools/nevr-runtime#116 ·
Maintainers usually reply within 1 day
-
code-quality libc++
Difficulty 1/5 Under an hour Newbie friendliness 82/100
llvm/llvm-project#229284 ·
Maintainers usually reply within 1 day
-
test-issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
llvm/offload-test-suite#1557 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
iOS: hidden scale bar invalidates its intrinsic content size on every layout pass of MLNMapViewOpen
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
maplibre/maplibre-native#4723 ·
Maintainers usually reply within 1 day