From d7ca416980bb3518398e8ea0f30f49d80a82e89a86571a5b82072e55b9b70143 Mon Sep 17 00:00:00 2001 From: copecone Date: Mon, 1 Jun 2026 18:00:30 +0900 Subject: [PATCH] Fix `File.Delete` Failure by Waiting for `FFmpegProcess` to Exit --- Core/RenderManager.cs | 2 +- Util/FFmpeg/FFmpegProcess.cs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Core/RenderManager.cs b/Core/RenderManager.cs index 0f05758..e258e98 100644 --- a/Core/RenderManager.cs +++ b/Core/RenderManager.cs @@ -601,7 +601,7 @@ namespace ADOFAIRenderer.Core if (_activeVideoFFmpeg != null) { - _activeVideoFFmpeg.Kill(); + _activeVideoFFmpeg.Kill(16384); _activeVideoFFmpeg = null; } diff --git a/Util/FFmpeg/FFmpegProcess.cs b/Util/FFmpeg/FFmpegProcess.cs index 065c180..43c6f1f 100644 --- a/Util/FFmpeg/FFmpegProcess.cs +++ b/Util/FFmpeg/FFmpegProcess.cs @@ -74,13 +74,17 @@ namespace ADOFAIRenderer.Util.FFmpeg } } - public void Kill() + public void Kill(int timeoutMs = 0) { try { if (_ffmpegProcess != null && !_ffmpegProcess.HasExited) { _ffmpegProcess.Kill(); + if (timeoutMs > 0) + { + _ffmpegProcess.WaitForExit(timeoutMs); + } } } catch (Exception)