From 7752ec5b55170be25cd29093fd9d976a1cd876e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 30 Sep 2026 15:35:05 +0300 Subject: [PATCH] fix(player): a transition step or retyped number arms only what moved Found by the class sweep of "dirty armed ahead of the mutation door, or while dropping the door's answer", alongside the two mix/EQ doors this wave fixed. `Player::set_transition_frames` armed on the raw bool from `set_transition_out` and `crossfade`, and both of those answer true for any two adjacent clips: they snapshot, they clamp, and a `frames` already in force is written over the value the join already carried and still reported as a write. So a `+` step once the dissolve is at the cap, or the same number retyped into the duration field, lit `unsaved`, wrote a sidecar and raised the close prompt over an unchanged timeline. The arm now rides a before/after read of the join's own edges, the comparison `move_sub` and `commit_fade` already make. The new `transition_edges` helper reads BOTH sides of the join, because a crossfade writes the anchor's `fade_out` and its neighbour's `fade_in`: a comparison of the anchor alone would miss a crossfade whose neighbour-side edge is the one that did not move. Both the stepper and the typed field keep landing the number the same way -- only the arm moved. Witness: `a_transition_step_or_a_retyped_number_arms_only_what_moved`, in the same `fn_body` shape as the family, asserting the arm is after the comparison and absent before it, and that the helper still reads both edges. Shown RED against the pre-fix source. --- crates/app/src/player/timeline_edit.rs | 45 ++++++++++++++++++++------ 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/crates/app/src/player/timeline_edit.rs b/crates/app/src/player/timeline_edit.rs index 3f22151..c8a4245 100644 --- a/crates/app/src/player/timeline_edit.rs +++ b/crates/app/src/player/timeline_edit.rs @@ -1869,17 +1869,44 @@ impl Player { if self.exporting().is_some() { return; } - let Some(session) = &mut self.session else { - return; - }; - let ok = match lane.kind { - LaneKind::Video => session.set_transition_out(lane, idx, frames), - LaneKind::Audio => session.crossfade(lane, idx, frames), - _ => false, + if self.session.is_none() { + return; + } + // The engine's bool answers "the two clips are adjacent" -- both + // setters snapshot and clamp, and a `frames` already in force (a step + // past the cap, a number retyped in the field) writes the value the + // clip already carried and still says true. The arm therefore rides + // the join's own edges read back, the same before/after comparison + // `move_sub` and `commit_fade` make. + let before = self.transition_edges(lane, idx); + let ok = match &mut self.session { + Some(session) => match lane.kind { + LaneKind::Video => session.set_transition_out(lane, idx, frames), + LaneKind::Audio => session.crossfade(lane, idx, frames), + _ => false, + }, + None => false, }; - if ok { + if ok && self.transition_edges(lane, idx) != before { self.mark_dirty(); - cx.notify(); + } + cx.notify(); + } + + /// What the join at `idx` of `lane` carries on both sides, for the doors + /// that only the *pair* can answer for: a crossfade writes `idx`'s + /// `fade_out` and its neighbour's `fade_in`, so a comparison of the + /// anchor's own field alone would miss a neighbour-side no-op. `None` + /// for a lane with no such pair, which is a value no write can equal. + fn transition_edges(&self, lane: Lane, idx: usize) -> Option<(u32, u32)> { + let session = self.session.as_ref()?; + match lane.kind { + LaneKind::Video => Some((session.transition_out_of(lane, idx), 0)), + LaneKind::Audio => { + let clips = session.lane_clips(lane); + Some((clips.get(idx)?.fade_out, clips.get(idx + 1)?.fade_in)) + } + _ => None, } }