Savestates: Fixup file write

This commit is contained in:
Elad Ashkenazi 2024-05-05 04:37:49 +03:00
parent 0fcb0b7d8e
commit 91a54c11eb
3 changed files with 11 additions and 8 deletions

View file

@ -3345,13 +3345,13 @@ void Emulator::Kill(bool allow_autoexit, bool savestate, savestate_stage* save_s
set_progress_message("Commiting File");
fs::file to_close_file;
{
auto& ar = *to_ar->load();
auto reset = init_mtx->reset();
to_close_file = std::move(file.file);
ar = {};
ar.set_reading_state(); // Guard against using it
reset.set_init();
}
to_close_file.close();
if (!file.commit() || !fs::get_stat(path, file_stat))
{