ui_thread_reconcile

Function ui_thread_reconcile 

Source
fn ui_thread_reconcile(state: &Arc<AppState>)
Expand description

UI-thread body. CEF Browser methods are safe here.

Re-snapshot browsers (state may have advanced since the IPC thread classified candidates — labels that have actually closed are no longer in the map; new candidates may have appeared, but we’ll catch them on the next HostShouldQuit). For each candidate that’s still present, probe its HWND: live → skip (Race B, freshly promoted), dead → close.

Drain mode is set ONLY if no live user browser remains after removing the zombies we’re about to close. A stale HostShouldQuit racing with a live user session must NOT flip quit_state to Draining, because there’s no transition back to Running and spawn_pool_window then refuses to refill the pool — silently degrading the live session.