Skip to content

Commit fa78d25

Browse files
authored
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.
1 parent 83e61c6 commit fa78d25

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

crates/egui_kittest/src/snapshot.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,11 +721,14 @@ impl<State> Harness<'_, State> {
721721
})
722722
.unwrap();
723723

724+
// Close temp file so it isn't locked when `open` tries to launch it (on Windows)
725+
let path = temp_file.into_temp_path();
726+
724727
#[expect(clippy::print_stdout)]
725728
{
726729
println!("Wrote debug snapshot to: {}", path.display());
727730
}
728-
let result = open::that(path);
731+
let result = open::that(&path);
729732
if let Err(err) = result {
730733
#[expect(clippy::print_stderr)]
731734
{

0 commit comments

Comments
 (0)