refactor(ui): own retained controller lifetimes

This commit is contained in:
Erik 2026-07-10 23:35:26 +02:00
parent 921c388e2c
commit 5d9e98c118
21 changed files with 373 additions and 35 deletions

View file

@ -93,3 +93,19 @@ compass/coordinates, `RadarSnapshotProvider` joins the existing `WorldEntity` +
and `UiRadar` only draws/handles retained interaction. `GameWindow` contains mount
and delegate wiring, not the feature body. See
`docs/research/2026-07-10-retail-radar-pseudocode.md`.
## 2026-07-10 retained window ownership
Every production retained window is registered through `RetailWindowManager` and
owned by a typed `RetailWindowHandle`. Controllers implement
`IRetainedPanelController`; windows with multiple focused controllers use
`RetainedPanelControllerGroup`, which forwards lifecycle in construction order and
disposes in reverse order exactly once. A controller created after a hidden mount
(inventory) is attached through `RetailWindowManager.AttachController`.
Controller event subscriptions must use removable named handlers or paired
subscribe/unsubscribe delegates. `UiHost.Dispose` first removes Silk mouse/keyboard
subscriptions, then disposes the manager/controllers, then the GL text renderer.
`GameWindow.OnClosing` disposes layout persistence and `UiHost` before live session
or game-state sources. This ordering is the recreate/relogin double-subscription
guard; do not reintroduce anonymous lifetime-bound event lambdas.