Fix Initialize sounds (dispose of null SoundSource)

This commit is contained in:
rob-v
2017-06-22 18:03:15 +02:00
committed by Paul Chote
parent 0a1083e554
commit 6df7f18a3b

View File

@@ -88,14 +88,12 @@ namespace OpenRA
if (sounds != null)
foreach (var soundSource in sounds.Values)
soundSource.Dispose();
if (soundSource != null)
soundSource.Dispose();
getSoundSource = s => LoadSound(loaders, fileSystem, s);
sounds = new Cache<string, ISoundSource>(getSoundSource);
currentSounds = new Dictionary<uint, ISound>();
music = null;
musicSource = null;
currentMusic = null;
video = null;
}
@@ -236,13 +234,15 @@ namespace OpenRA
{
soundEngine.StopSound(music);
soundEngine.ReleaseSound(music);
music = null;
musicSource.Dispose();
musicSource = null;
}
MusicPlaying = false;
if (musicSource != null)
musicSource.Dispose();
music = null;
musicSource = null;
currentMusic = null;
MusicPlaying = false;
}
public void PauseMusic()