Summary
Godot crashes with EXC_BAD_ACCESS (SIGABRT) during headless shutdown (Main::cleanup). The crash stack shows GDScriptInstance::~GDScriptInstance() → Object::_predelete() → Variant::_clear_internal() with a dangling recursive_mutex at 0x1d8. This is a use-after-free on a GDScriptInstance during singleton teardown.
Root Cause
scripts/combat/turn_manager.gd:29-32 connects to EntityLifecycle.entity_state_changed in _ready() but never disconnects in _exit_tree(). Since EntityLifecycle is an autoload singleton, when Godot cleans up at shutdown, the order of singleton destruction can leave TurnManagers signal callback pointing to freed memory.
Impact
- CI pipeline always crashes (blocking all workflows)
- Headless test suite cannot complete
- Any gameplay session that exits back to menu will also crash
Location
scripts/combat/turn_manager.gd — missing _exit_tree() override
Suggested Fix
Add an _exit_tree() method in turn_manager.gd that disconnects EntityLifecycle.entity_state_changed if connected. Audit all other autoload signal connections in the project for the same pattern.
Priority: P0 · Size: S · Status: Ready
Summary
Godot crashes with
EXC_BAD_ACCESS (SIGABRT)during headless shutdown (Main::cleanup). The crash stack showsGDScriptInstance::~GDScriptInstance()→Object::_predelete()→Variant::_clear_internal()with a danglingrecursive_mutexat0x1d8. This is a use-after-free on a GDScriptInstance during singleton teardown.Root Cause
scripts/combat/turn_manager.gd:29-32connects toEntityLifecycle.entity_state_changedin_ready()but never disconnects in_exit_tree(). SinceEntityLifecycleis an autoload singleton, when Godot cleans up at shutdown, the order of singleton destruction can leave TurnManagers signal callback pointing to freed memory.Impact
Location
scripts/combat/turn_manager.gd— missing_exit_tree()overrideSuggested Fix
Add an
_exit_tree()method inturn_manager.gdthat disconnectsEntityLifecycle.entity_state_changedif connected. Audit all other autoload signal connections in the project for the same pattern.Priority: P0 · Size: S · Status: Ready