Skip to content

FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust

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

Brandon Thomas0ec8c73e8ff1
diff --git a/crates/ui-egui/src/panels/masks.rs b/crates/ui-egui/src/panels/masks.rs
index 431465ea5..c582607d2 100644
--- a/crates/ui-egui/src/panels/masks.rs
+++ b/crates/ui-egui/src/panels/masks.rs
@@ -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() {