From ce82fcd9fafd316ef7b4b9795feb193eccb05d87 Mon Sep 17 00:00:00 2001 From: baiqing Date: Sun, 10 May 2026 01:25:11 +0800 Subject: [PATCH] fix(coordinator): clear focus_target on cancel regardless of phase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit finish_cancel_session_state previously only cleared state.focus_target when the cancelled phase was not Processing — Processing-phase cancel left the stale window-resource handle in place until the next begin_session_state overwrote it. Between cancel and next begin, any reader of focus_target sees a value belonging to a session that is about to be torn down. Move state.focus_target = None ahead of the phase check so it always fires when the cancel was accepted (i.e. not rejected for Idle / Inserting phases). Phase transition stays conditional on the original non-Processing branch, since end_session must still own the Processing → Idle collapse to avoid racing with polish/insert. Tighten cancel_session_state_machine_is_table_driven so it asserts focus_target gets cleared for every accepted phase (including Processing) and stays untouched on rejected cancels. Audit ID 3.3.5. --- .../app/src-tauri/src/coordinator_state.rs | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/openless-all/app/src-tauri/src/coordinator_state.rs b/openless-all/app/src-tauri/src/coordinator_state.rs index 70733327..82ce5672 100644 --- a/openless-all/app/src-tauri/src/coordinator_state.rs +++ b/openless-all/app/src-tauri/src/coordinator_state.rs @@ -164,11 +164,14 @@ pub(crate) fn begin_cancel_session_state(state: &mut SessionState) -> Option