handle_report_window_closed

Function handle_report_window_closed 

Source
pub(super) fn handle_report_window_closed(
    state: &mut State,
    label: String,
) -> Vec<Event>
Expand description

Phase B.4 — drop a host-reported window from the mirror. Returns Event::WindowClosed only when the label was actually in the mirror; an unknown-label close is a silent no-op (codex P2 PR #577 round-2). Without this gate, a ReportWindowClosed for a label the launcher never saw (e.g. a pool window that was popped from the queue but failed HWND validation in promote_pool_window — the orphan window’s eventual on_before_close reaches us without a matching open) would emit an unpaired WindowClosed broadcast and break subscribers that assume open/close pairing.

Phase B.5 — also drops the label from instance_registry and emits WindowInstanceReleased if a number was assigned. next_instance_num is NOT decremented — instance numbers are monotonic per-launcher-run.