diff --git a/crates/metal2vulkan-runtime/src/tests/stage.rs b/crates/metal2vulkan-runtime/src/tests/stage.rs index 16cd9e400..145b0fcab 100644 --- a/crates/metal2vulkan-runtime/src/tests/stage.rs +++ b/crates/metal2vulkan-runtime/src/tests/stage.rs @@ -910,6 +910,9 @@ mod on_device { let made = (device .new_compute_pipeline_state(&descriptor, crate::tests::no_constexpr_samplers)) .err(); + // The clone goes before the answer, so the caller's drop is the device's last and + // no thread of the test destroys it while the process exits. + drop(device); let _ = answer.send(made); }); answered @@ -940,7 +943,10 @@ mod on_device { let (filled, fill) = mpsc::channel(); let (filler, asked) = (device.clone(), request.clone()); std::thread::spawn(move || { - let _ = filled.send(filler.fill_stage(&asked, to_helper, from_helper)); + let fill = filler.fill_stage(&asked, to_helper, from_helper); + // As in `bounded`: the clone goes before the answer. + drop(filler); + let _ = filled.send(fill); }); let filled = fill.recv_timeout(PATIENCE); let filled = filled.unwrap_or_else(|_| panic!("{name}: the fill never ended"));