fix crash on asset auto-upgrade

This commit is contained in:
fibref
2026-01-01 17:44:33 +08:00
parent 1cad2489a3
commit b87f8b96e1

View File

@@ -146,6 +146,10 @@ bool BinaryAssetFactoryBase::UpgradeAsset(const AssetInfo& info, FlaxStorage* st
context.Input = context.Output;
} while (upgrader->ShouldUpgrade(context.Input.SerializedVersion));
// Prevent other threads from loading the storage when it is upgrading
// It works because CriticalSection allows recursion
ScopeLock upgradeLock(storage->_loadLocker);
// Release storage internal data (should also close file handles)
{
// HACK: file is locked by some tasks: the current one that called asset data upgrade (LoadAssetTask)