From 38a5313ed2c4ebb626017a4f7f28ed0c0a89f931 Mon Sep 17 00:00:00 2001 From: Eladash Date: Fri, 21 Jul 2023 12:08:01 +0300 Subject: [PATCH] Fix log data loss on force application shutdown --- rpcs3/rpcs3qt/main_window.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index 8955b94c3d..a2025de926 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -2413,6 +2413,12 @@ void main_window::CreateConnects() // Try to copy it if fails if (fs::copy_file(from, to, true)) { + if (fs::file sync_fd{to, fs::write}) + { + // Prevent data loss (expensive) + sync_fd.sync(); + } + fs::remove_file(from); return true; }