masks: the pen tool no longer deadlocks egui when a drag places a point (#667 regression)

pen_overlay read resp.drag_started_by() inside ui.data_mut(), which holds
the context's write lock that drag_started_by needs. A Shift-drag that
placed a point hung for egui's 10 s lock timeout, then panicked
(shift_constrains_pen_mask_segments_to_45_degrees got 3 points, not 4).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas 2026-10-11 21:51:06 -04:00
parent ab85b3d757
commit 0ec8c73e8f
1 changed files with 3 additions and 1 deletions

View File

@ -599,7 +599,9 @@ fn pen_overlay(app: &mut FilmcraftApp, ui: &mut egui::Ui, pic: Rect, frame: (u32
} else {
let c = to_c(snap(d.points.last(), p));
d.points.push([c.x, c.y, 0.0, 0.0]);
ui.data_mut(|m| m.insert_temp(egui::Id::new("mask-pen-placed"), resp.drag_started_by(LEFT)));
// read the response before data_mut: it locks the context that drag_started_by reads
let dragging = resp.drag_started_by(LEFT);
ui.data_mut(|m| m.insert_temp(egui::Id::new("mask-pen-placed"), dragging));
}
}
if resp.clicked() || resp.drag_stopped() {