From ae8a3c61d50b1394bdd8fcec09c20b97008b6d02 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Wed, 8 Oct 2014 22:29:22 +0200 Subject: [PATCH] Fix disposed exception on disposing a texture --- VocaluxeLib/Draw/CTextureRef.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/VocaluxeLib/Draw/CTextureRef.cs b/VocaluxeLib/Draw/CTextureRef.cs index d593cb12..1f13444d 100644 --- a/VocaluxeLib/Draw/CTextureRef.cs +++ b/VocaluxeLib/Draw/CTextureRef.cs @@ -68,8 +68,8 @@ namespace VocaluxeLib.Draw //Free textures that are no longer referenced CTextureRef tmp = this; CBase.Drawing.RemoveTexture(ref tmp); + _SetRemoved(); } - SetRemoved(); } /// @@ -80,6 +80,11 @@ namespace VocaluxeLib.Draw { if (ID < 0) throw new ObjectDisposedException(GetType().Name); + _SetRemoved(); + } + + private void _SetRemoved() + { ID = -1; GC.SuppressFinalize(this); }