From b580c2737f061999019b4e73797a411491035f96 Mon Sep 17 00:00:00 2001 From: Maxime Gervais Date: Fri, 4 Oct 2024 19:06:14 +0200 Subject: [PATCH] Fix crash or hang in some cases Signed-off-by: Maxime Gervais --- Source/Common/Core.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Common/Core.cpp b/Source/Common/Core.cpp index 03696bb6..3ec6eb7c 100644 --- a/Source/Common/Core.cpp +++ b/Source/Common/Core.cpp @@ -562,12 +562,13 @@ size_t Core::Menu_File_Open_Files_Finish_End() { CS.Enter(); Canceled=true; - Handler->second.Riff->Cancel(); + if (Handler->second.Riff) + Handler->second.Riff->Cancel(); CS.Leave(); - while(!IsExited()) + while(Handler->second.Riff && !Handler->second.Riff->Canceled_Get()) Sleep(20); } - + CriticalSectionLocker CSL(CS); //In case of cancel @@ -581,7 +582,6 @@ size_t Core::Menu_File_Open_Files_Finish_End() Handler++; Handlers.erase(Handler_ToDelete); - CriticalSectionLocker CSL(CS); Menu_File_Open_Files_File_Pos--; Menu_File_Open_Files_File_Total--; }