diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs index 11cd69f4..0a7ace7c 100644 --- a/Vocaluxe/Lib/Draw/CDirect3D.cs +++ b/Vocaluxe/Lib/Draw/CDirect3D.cs @@ -65,6 +65,11 @@ namespace Vocaluxe.Lib.Draw public override void Dispose() { + if (IsDisposed) + { + return; + } + base.Dispose(); if (D3DTexture != null) { diff --git a/Vocaluxe/Lib/Draw/COpenGL.cs b/Vocaluxe/Lib/Draw/COpenGL.cs index f396d3b7..a84791ac 100644 --- a/Vocaluxe/Lib/Draw/COpenGL.cs +++ b/Vocaluxe/Lib/Draw/COpenGL.cs @@ -91,6 +91,11 @@ namespace Vocaluxe.Lib.Draw public override void Dispose() { + if (IsDisposed) + { + return; + } + base.Dispose(); if (Name != 0) { diff --git a/Vocaluxe/Lib/Draw/CTextureBase.cs b/Vocaluxe/Lib/Draw/CTextureBase.cs index 938b8544..b0ad146b 100644 --- a/Vocaluxe/Lib/Draw/CTextureBase.cs +++ b/Vocaluxe/Lib/Draw/CTextureBase.cs @@ -92,17 +92,17 @@ namespace Vocaluxe.Lib.Draw } } - private bool _IsDisposed; + protected bool IsDisposed { get; private set; } public virtual void Dispose() { - if (_IsDisposed) + if (IsDisposed) { - throw new ObjectDisposedException(GetType().Name); + return; } RefCount = 0; - _IsDisposed = true; + IsDisposed = true; } } } \ No newline at end of file diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index 5a5f0013..b97fe66e 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -389,7 +389,7 @@ namespace VocaluxeLib.Menu public void RenameValue(int index, string newName, CTextureRef newTexture = null) { - if (index < 0 && index >= _Values.Count) + if (index < 0 || index >= _Values.Count) { return; }