Root nodes join through ModRoot.AddDeferred, so a reload that unloads the mod first never hands Godot a freed node

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
cthangoverandClaude Opus 5.5 committed 2026-10-24 11:29:20 +02:00
1 parent f9bb809ed1
commit 7b699a642b
2 files changed
+3 -4

No files matched your search

+2 -3
View File
@@ -29,13 +29,12 @@ namespace Cthangover.Mods.ScenarioStudio
var layer = new StudioLayer(args); var layer = new StudioLayer(args);
layer.Mount(); layer.Mount();
var root = (Godot.Engine.GetMainLoop() as SceneTree)?.Root; ModRoot.AddDeferred(new StudioLive(layer));
root?.CallDeferred("add_child", new StudioLive(layer));
if (!args.Contains(Flag)) if (!args.Contains(Flag))
return; return;
GameLogger.Log("UI", "Scenario studio: --studio given, the dock opens with the first scene"); GameLogger.Log("UI", "Scenario studio: --studio given, the dock opens with the first scene");
root?.CallDeferred("add_child", new StudioAutoOpenNode()); ModRoot.AddDeferred(new StudioAutoOpenNode());
} }
} }
} }
@@ -35,7 +35,7 @@ namespace Cthangover.Mods.ScenarioStudio.Tests.Live
driverQueued = true; driverQueued = true;
GameLogger.Log("TEST", $"StudioLiveTestInitializer: activating studio live test, shots='{shots ?? ""}'"); GameLogger.Log("TEST", $"StudioLiveTestInitializer: activating studio live test, shots='{shots ?? ""}'");
(Godot.Engine.GetMainLoop() as SceneTree)?.Root?.CallDeferred("add_child", new StudioLiveDriverNode(shots)); ModRoot.AddDeferred(new StudioLiveDriverNode(shots));
} }
} }
} }