Skip to content

Editor crashes on shutdown when fetching a singleton via Engine #1900

@Naros

Description

@Naros

Godot version

4.6.beta2

godot-cpp version

4.5.0.stable sync and b724219

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis has been identified as a bugcrash

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions