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:
parent
ab85b3d757
commit
0ec8c73e8f
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue