Test a fix
diff --git a/sparse_strips/vello_cpu/src/dispatch/multi_threaded.rs b/sparse_strips/vello_cpu/src/dispatch/multi_threaded.rs index f95d086..94ea6ae 100644 --- a/sparse_strips/vello_cpu/src/dispatch/multi_threaded.rs +++ b/sparse_strips/vello_cpu/src/dispatch/multi_threaded.rs
@@ -319,6 +319,7 @@ self.alpha_storage = Arc::new(OnceLockAlphaStorage::new(self.num_threads)); let workers = self.workers.clone(); + let alpha_storage = self.alpha_storage.clone(); // + 1 since we also wait on the main thread. let barrier = Arc::new(Barrier::new(usize::from(self.num_threads) + 1)); let t_barrier = barrier.clone(); @@ -327,6 +328,7 @@ let worker = workers.get().unwrap(); let mut borrowed = worker.borrow_mut(); borrowed.reset(); + borrowed.alpha_storage = alpha_storage.clone(); t_barrier.wait(); });
diff --git a/sparse_strips/vello_cpu/src/render.rs b/sparse_strips/vello_cpu/src/render.rs index 192bc38..fc21090 100644 --- a/sparse_strips/vello_cpu/src/render.rs +++ b/sparse_strips/vello_cpu/src/render.rs
@@ -571,7 +571,7 @@ ctx.push_clip_layer(&Rect::new(20.0, 20.0, 180.0, 180.0).to_path(0.1)); ctx.pop_layer(); } - + #[cfg(feature = "multithreading")] #[test] fn multithreaded_crash_after_reset() { @@ -580,7 +580,7 @@ level: Level::new(), num_threads: 1, }; - + let mut ctx = RenderContext::new_with(200, 200, &settings); ctx.reset(); ctx.fill_path(&Rect::new(0.0, 0.0, 100.0, 100.0).to_path(0.1));