Skip to content

Projects with autoloads crash during headless import #108990

@mihe

Description

@mihe

Tested versions

Reproducible in: 4.5.beta [0dd9178]
Not reproducible in: 4.5.beta [8acc596]

System information

Godot v4.5.beta (0dd9178) - Fedora Linux 42 (Adams) on Wayland - X11 display driver, Multi-window, 2 monitors - Vulkan (Forward+) - dedicated AMD Radeon RX 9070 XT (RADV GFX1201) - AMD Ryzen 9 9950X3D 16-Core Processor (32 threads) - 60.39 GiB memory

Issue description

When running --headless --import on seemingly any project that has any autoload singleton, you get the following crash: signal SIGSEGV: address not mapped to object with this backtrace:

SceneTree::get_root() const (scene/main/scene_tree.h:300)
EditorAutoloadSettings::init_autoloads() (editor/settings/editor_autoload_settings.cpp:454)
ProjectSettingsEditor::init_autoloads() (editor/settings/project_settings_editor.cpp:117)
EditorFileSystem::_first_scan_filesystem() (editor/file_system/editor_file_system.cpp:340)
EditorFileSystem::scan() (editor/file_system/editor_file_system.cpp:1070)
EditorNode::_begin_first_scan() (editor/editor_node.cpp:5623)
EditorNode::_notification(int) (editor/editor_node.cpp:854)
EditorNode::_notification_forwardv(int) (editor/editor_node.h:118)
Object::_notification_forward(int) (core/object/object.cpp:931)
Object::notification(int, bool) (core/object/object.h:890)
Node::_propagate_enter_tree() (scene/main/node.cpp:341)
Node::_propagate_enter_tree() (scene/main/node.cpp:360)
Node::_set_tree(SceneTree*) (scene/main/node.cpp:3311)
SceneTree::initialize() (scene/main/scene_tree.cpp:568)
OS_LinuxBSD::run() (platform/linuxbsd/os_linuxbsd.cpp:975)
main (platform/linuxbsd/godot_linuxbsd.cpp:85)

Which seems to be because this error gets tripped:

godot/scene/main/node.h

Lines 505 to 508 in 0dd9178

_FORCE_INLINE_ SceneTree *get_tree() const {
ERR_FAIL_NULL_V(data.tree, nullptr);
return data.tree;
}

This seems to be a regression from #108893.

Steps to reproduce

  1. Run Godot with --headless --import in the MRP.
  2. Note the crash after the first_scan_filesystem | Creating autoload scripts... step.
  3. Also note the error saying ERROR: Parameter "data.tree" is null..

Minimal reproduction project (MRP)

autoload-import-crash.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Immediate Blocker

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions