Fix AssetBus connection policy to re-lock the mutex afterward since some destructors in the calling methods are still altering the context (#5575)
Also made the unlock conditional. Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>
This commit is contained in:
@@ -556,16 +556,24 @@ namespace AZ
|
||||
Asset<AssetData> assetData(AssetInternal::GetAssetData(actualId, AZ::Data::AssetLoadBehavior::Default));
|
||||
if (assetData)
|
||||
{
|
||||
auto curStatus = assetData->GetStatus();
|
||||
auto isReady = assetData->GetStatus() == AssetData::AssetStatus::Ready;
|
||||
bool isError = assetData->IsError();
|
||||
connectLock.unlock();
|
||||
if (curStatus == AssetData::AssetStatus::Ready)
|
||||
|
||||
if (isReady || isError)
|
||||
{
|
||||
handler->OnAssetReady(assetData);
|
||||
}
|
||||
else if (isError)
|
||||
{
|
||||
handler->OnAssetError(assetData);
|
||||
connectLock.unlock();
|
||||
|
||||
if (isReady)
|
||||
{
|
||||
handler->OnAssetReady(assetData);
|
||||
}
|
||||
else if (isError)
|
||||
{
|
||||
handler->OnAssetError(assetData);
|
||||
}
|
||||
|
||||
// Lock the mutex again since some destructors will be modifying the context afterwards
|
||||
connectLock.lock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user