Fixed AssetBrowserLogic disposing audio streams prematurely

This commit is contained in:
penev92
2022-01-04 23:58:07 +02:00
committed by Matthias Mailänder
parent 6fb228ddd1
commit b6b417d42f

View File

@@ -481,11 +481,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
// Mute music so it doesn't interfere with the current asset. // Mute music so it doesn't interfere with the current asset.
MuteSounds(); MuteSounds();
using (var soundStream = Game.ModData.DefaultFileSystem.Open(prefix + filename)) currentAudioStream = Game.ModData.DefaultFileSystem.Open(prefix + filename);
{
foreach (var modDataSoundLoader in Game.ModData.SoundLoaders) foreach (var modDataSoundLoader in Game.ModData.SoundLoaders)
{ {
if (modDataSoundLoader.TryParseSound(soundStream, out currentSoundFormat)) if (modDataSoundLoader.TryParseSound(currentAudioStream, out currentSoundFormat))
{ {
if (frameSlider != null) if (frameSlider != null)
{ {
@@ -497,7 +496,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
} }
} }
} }
}
else if (allowedVideoExtensions.Contains(fileExtension)) else if (allowedVideoExtensions.Contains(fileExtension))
{ {
// Mute music so it doesn't interfere with the current asset. // Mute music so it doesn't interfere with the current asset.