Fix Initialize sounds (dispose of null SoundSource)
This commit is contained in:
@@ -88,14 +88,12 @@ namespace OpenRA
|
|||||||
|
|
||||||
if (sounds != null)
|
if (sounds != null)
|
||||||
foreach (var soundSource in sounds.Values)
|
foreach (var soundSource in sounds.Values)
|
||||||
soundSource.Dispose();
|
if (soundSource != null)
|
||||||
|
soundSource.Dispose();
|
||||||
|
|
||||||
getSoundSource = s => LoadSound(loaders, fileSystem, s);
|
getSoundSource = s => LoadSound(loaders, fileSystem, s);
|
||||||
sounds = new Cache<string, ISoundSource>(getSoundSource);
|
sounds = new Cache<string, ISoundSource>(getSoundSource);
|
||||||
currentSounds = new Dictionary<uint, ISound>();
|
currentSounds = new Dictionary<uint, ISound>();
|
||||||
music = null;
|
|
||||||
musicSource = null;
|
|
||||||
currentMusic = null;
|
|
||||||
video = null;
|
video = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,13 +234,15 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
soundEngine.StopSound(music);
|
soundEngine.StopSound(music);
|
||||||
soundEngine.ReleaseSound(music);
|
soundEngine.ReleaseSound(music);
|
||||||
music = null;
|
|
||||||
musicSource.Dispose();
|
|
||||||
musicSource = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MusicPlaying = false;
|
if (musicSource != null)
|
||||||
|
musicSource.Dispose();
|
||||||
|
|
||||||
|
music = null;
|
||||||
|
musicSource = null;
|
||||||
currentMusic = null;
|
currentMusic = null;
|
||||||
|
MusicPlaying = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PauseMusic()
|
public void PauseMusic()
|
||||||
|
|||||||
Reference in New Issue
Block a user