From fa78d25564a5dbcb546ff6db0a9e14cb603ba03b Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Mon, 19 Jan 2026 10:47:10 -0300 Subject: [PATCH] egui_kittest: Close debug_open_snapshot temp file before viewing it (#7841) The image file written by debug_open_snapshot was being kept open by the `tempfile` object. On Windows, this prevented `open::that` from successfully launching the viewer sometimes because the file remained locked, which can be avoided by first releasing the file handle. --- crates/egui_kittest/src/snapshot.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/egui_kittest/src/snapshot.rs b/crates/egui_kittest/src/snapshot.rs index 4d139fcbb..8134dbdf0 100644 --- a/crates/egui_kittest/src/snapshot.rs +++ b/crates/egui_kittest/src/snapshot.rs @@ -721,11 +721,14 @@ impl Harness<'_, State> { }) .unwrap(); + // Close temp file so it isn't locked when `open` tries to launch it (on Windows) + let path = temp_file.into_temp_path(); + #[expect(clippy::print_stdout)] { println!("Wrote debug snapshot to: {}", path.display()); } - let result = open::that(path); + let result = open::that(&path); if let Err(err) = result { #[expect(clippy::print_stderr)] {