Fix crash when reimporting audio clip while it's being played

This commit is contained in:
Wojtek Figat
2023-04-20 10:56:57 +02:00
parent 6ec35e5175
commit d719ef8d03
2 changed files with 30 additions and 9 deletions

View File

@@ -126,12 +126,18 @@ namespace FlaxEditor.Viewport.Previews
{
lock (_locker)
{
// Release any cached data
_pcmData = null;
if (_asset != null)
{
// Release any cached data
_pcmData = null;
// Invalidate any in-flight data download to reject cached data due to refresh
if (_pcmSequence != 0)
_pcmSequence++;
// Invalidate any in-flight data download to reject cached data due to refresh
if (_pcmSequence != 0)
_pcmSequence++;
// Use async task to gather PCM data (engine loads it from the asset)
Task.Run(DownloadData);
}
}
}