Dispose some sound streams.

This commit is contained in:
RoosterDragon
2016-12-23 19:37:17 +00:00
parent 53bd29351b
commit 226c0a050a
6 changed files with 32 additions and 16 deletions

View File

@@ -42,18 +42,24 @@ namespace OpenRA.GameRules
if (!fileSystem.TryOpen(Filename, out stream))
return;
Exists = true;
ISoundFormat soundFormat;
foreach (var loader in Game.ModData.SoundLoaders)
try
{
if (loader.TryParseSound(stream, out soundFormat))
Exists = true;
foreach (var loader in Game.ModData.SoundLoaders)
{
Length = (int)soundFormat.LengthInSeconds;
break;
ISoundFormat soundFormat;
if (loader.TryParseSound(stream, out soundFormat))
{
Length = (int)soundFormat.LengthInSeconds;
soundFormat.Dispose();
break;
}
}
}
stream.Dispose();
finally
{
stream.Dispose();
}
}
}
}