From c3dacb1e5228c05ae146b711c007ee38e4b7ef1c Mon Sep 17 00:00:00 2001 From: AMZN-stankowi <4838196+AMZN-stankowi@users.noreply.github.com> Date: Tue, 16 Nov 2021 08:07:20 -0800 Subject: [PATCH] Unlocked a mutex after modifying the associated variable (#5625) * Unlocked a mutex after modifying the variable the mutex was meant for. This fixes an issue where mounting bundles in the Editor was causing the Editor to freeze up, because the following line, m_levelOpenEvent.Signal, resulted in another attempt to lock that same mutex. Signed-off-by: AMZN-stankowi <4838196+AMZN-stankowi@users.noreply.github.com> * Added a comment describing why the unlock is necessary. Signed-off-by: AMZN-stankowi <4838196+AMZN-stankowi@users.noreply.github.com> --- Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp b/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp index c1c5775958..0fede85aa7 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp +++ b/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp @@ -1241,6 +1241,10 @@ namespace AZ::IO m_arrZips.insert(revItZip.base(), desc); + // This lock is for m_arrZips. + // Unlock it now because the modification is complete, and events responding to this signal + // will attempt to lock the same mutex, causing the application to lock up. + lock.unlock(); m_levelOpenEvent.Signal(levelDirs); }