Fix deadlock between content storage and asset that is being updated during load

#2621
This commit is contained in:
Wojtek Figat
2024-05-20 14:22:03 +02:00
parent 2418167182
commit cfc9f73744
4 changed files with 10 additions and 7 deletions

View File

@@ -187,6 +187,9 @@ Asset::LoadResult Material::load()
#endif
)
{
// Guard file with the lock during shader generation (prevents FlaxStorage::Tick from messing with the file)
auto lock = Storage->Lock();
// Prepare
MaterialGenerator generator;
generator.Error.Bind(&OnGeneratorError);