You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Editor crashes on shutdown when fetching a singleton via Engine #1900
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)
As discussed in dev chat, this seems to be related to #1458. Apply this in the Engine method call addresses the issue, although we recognize this isn't the right fix
So, I think the problem is that the fix we added in #1458 only applied to the classes static get_singleton() methods and we need to make sure the same applies to Object *Engine::get_singleton(const StringName &)
I've spent a couple hours trying to find the right solution, and haven't quite gotten there yet.
My original idea was that the singletons' constructors could set singleton and call _register_engine_singleton(), rather than having the static get_singleton() do it, so the right thing would happen for singletons no matter how they were constructed. However, that ran into a ton of different problems, so I'm back to the drawing board.
I may end up pursuing a solution similar to the change in the comments above, even if it's not ideal
It turns out trying to do something like the comments above also had problems, so I've gone back to the constructor approach - it's seems the least bad/weird of the two :-)
I just posted PR #1908 with a potential fix - please let me know if it work for you!
I experience the same issue when using the Time singleton. However, I’ve noticed that the crash only occurs on exit when running official Godot builds. It doesn’t happen with my own compiled version from same exact codebase/commit. I suspect the difference is that the official Windows builds are compiled with MinGW, while I compile mine using MSVC.
Activity
Naros commentedon Jan 5, 2026
As discussed in dev chat, this seems to be related to #1458. Apply this in the Engine method call addresses the issue, although we recognize this isn't the right fix
dsnopek commentedon Jan 5, 2026
On chat, I asked @Naros to test changing
Object *Engine::get_singleton(const StringName &)to this code:... and he said it fixed the issue for him!
So, I think the problem is that the fix we added in #1458 only applied to the classes static
get_singleton()methods and we need to make sure the same applies toObject *Engine::get_singleton(const StringName &)UPDATE: Oops, cross post :-)
Naros commentedon Jan 22, 2026
Hi @dsnopek did you find any resolution for this at all?
dsnopek commentedon Jan 22, 2026
I've spent a couple hours trying to find the right solution, and haven't quite gotten there yet.
My original idea was that the singletons' constructors could set
singletonand call_register_engine_singleton(), rather than having the staticget_singleton()do it, so the right thing would happen for singletons no matter how they were constructed. However, that ran into a ton of different problems, so I'm back to the drawing board.I may end up pursuing a solution similar to the change in the comments above, even if it's not ideal
Naros commentedon Jan 23, 2026
Is this something that you believe will make its way into 4.6.0-stable or likely slip?
dsnopek commentedon Jan 23, 2026
It turns out trying to do something like the comments above also had problems, so I've gone back to the constructor approach - it's seems the least bad/weird of the two :-)
I just posted PR #1908 with a potential fix - please let me know if it work for you!
CycloneRing commentedon Jun 23, 2026
I experience the same issue when using the Time singleton. However, I’ve noticed that the crash only occurs on exit when running official Godot builds. It doesn’t happen with my own compiled version from same exact codebase/commit. I suspect the difference is that the official Windows builds are compiled with MinGW, while I compile mine using MSVC.
Naros commentedon Jun 24, 2026
Hi @CycloneRing, I don't think it's a MinGW vs MSVC issue, as I used VS2022 previously and had the same problem.
Ivorforce commentedon Jul 28, 2026
To bring this discussion up to date: