Add some missing Dispose calls, fix some Dispose implementations.

This commit is contained in:
RoosterDragon
2015-12-29 20:11:09 +00:00
parent 85ffd505c1
commit b5f24c3fa6
11 changed files with 52 additions and 18 deletions

View File

@@ -304,13 +304,24 @@ namespace OpenRA.Platforms.Default
AL10.alListenerf(EFX.AL_METERS_PER_UNIT, .01f);
}
~OpenAlSoundEngine()
{
Game.RunAfterTick(() => Dispose(false));
}
public void Dispose()
{
if (device == IntPtr.Zero)
return;
Game.RunAfterTick(() => Dispose(true));
GC.SuppressFinalize(this);
}
ALC10.alcCloseDevice(device);
device = IntPtr.Zero;
void Dispose(bool disposing)
{
if (device != IntPtr.Zero)
{
ALC10.alcCloseDevice(device);
device = IntPtr.Zero;
}
}
}