Fix crash in particles system when assets gets loading/unloaded while async jobs are active
This commit is contained in:
@@ -72,6 +72,8 @@ namespace
|
||||
|
||||
Asset::LoadResult ParticleEmitter::load()
|
||||
{
|
||||
ConcurrentSystemLocker::WriteScope systemScope(Particles::SystemLocker);
|
||||
|
||||
// Load the graph
|
||||
const auto surfaceChunk = GetChunk(SHADER_FILE_CHUNK_VISJECT_SURFACE);
|
||||
if (!surfaceChunk)
|
||||
@@ -287,6 +289,7 @@ Asset::LoadResult ParticleEmitter::load()
|
||||
|
||||
void ParticleEmitter::unload(bool isReloading)
|
||||
{
|
||||
ConcurrentSystemLocker::WriteScope systemScope(Particles::SystemLocker);
|
||||
#if COMPILE_WITH_SHADER_COMPILER
|
||||
UnregisterForShaderReloads(this);
|
||||
#endif
|
||||
@@ -389,7 +392,7 @@ bool ParticleEmitter::SaveSurface(BytesContainer& data)
|
||||
LOG(Error, "Asset loading failed. Cannot save it.");
|
||||
return true;
|
||||
}
|
||||
|
||||
ConcurrentSystemLocker::WriteScope systemScope(Particles::SystemLocker);
|
||||
ScopeLock lock(Locker);
|
||||
|
||||
// Release all chunks
|
||||
|
||||
Reference in New Issue
Block a user