fix(plugins): close LA5 host lifecycle review

This commit is contained in:
Erik 2026-08-14 19:05:13 +02:00
parent 95f4be94db
commit fbe9c8a288
25 changed files with 1043 additions and 120 deletions

View file

@ -447,6 +447,11 @@ public sealed class GameWindowSlice8BoundaryTests
public void Shutdown_PreservesDependencyStagesAndNativeWindowLast()
{
string source = GameWindowSource();
string program = File.ReadAllText(Path.Combine(
FindRepoRoot(),
"src",
"AcDream.App",
"Program.cs"));
string lifetime = GameWindowLifetimeSource();
string manifest = Slice(
lifetime,
@ -464,6 +469,7 @@ public sealed class GameWindowSlice8BoundaryTests
[
"new ResourceShutdownStage(\"host and session barriers\"",
"new ResourceShutdownStage(\"physical ingress cleanup\"",
"new ResourceShutdownStage(\"plugin host\"",
"new ResourceShutdownStage(\"frame borrowers\"",
"new ResourceShutdownStage(\"session dependents\"",
"new ResourceShutdownStage(\"live entities\"",
@ -499,6 +505,8 @@ public sealed class GameWindowSlice8BoundaryTests
"Soft(\"gameplay actions\", () => DisposeGameplayActions(ingress.GameplayActions))",
"Soft(\"camera pointer\", () => DisposeCameraPointer(ingress.CameraPointer))",
"Soft(\"native window callbacks\", () => DisposeWindowCallbacks(ingress.WindowCallbacks))",
"new ResourceShutdownStage(\"plugin host\"",
"Hard(\"plugins\", () => ingress.Plugins?.Dispose())",
"new ResourceShutdownStage(\"session dependents\"",
"Hard(\"mouse capture\", () => live.CameraPointer?.ReleaseMouseLookAfterSessionRetirement())");
Assert.Contains(
@ -509,7 +517,27 @@ public sealed class GameWindowSlice8BoundaryTests
"UiHost? RetainedUiHost,",
lifetime,
StringComparison.Ordinal);
Assert.Contains(
"IDisposable? Plugins,",
lifetime,
StringComparison.Ordinal);
Assert.Contains("_uiHost,", source, StringComparison.Ordinal);
Assert.Contains("_pluginSession,", source, StringComparison.Ordinal);
AssertAppearsInOrder(
program,
"GraphicalPluginSession pluginSession = GraphicalPluginSession.Create(",
"window.StartPluginHosting(pluginSession);",
"window.Run();");
AssertAppearsInOrder(
source,
"_pluginSession = pluginSession;",
"pluginSession.Start();",
"public void Run()");
AssertAppearsInOrder(
manifest,
"Hard(\"plugins\", () => ingress.Plugins?.Dispose())",
"Hard(\"retail UI\", () => DisposeRetailUi(live.RetailUi))",
"Hard(\"game runtime\", () => DisposeGameRuntime(live.Runtime))");
AssertAppearsInOrder(
nativeRelease,
"TryComplete();",