Fix disposed exception on disposing a texture

This commit is contained in:
Flamefire committed 2014-10-08 22:29:22 +02:00
1 parent defb2ca6c7
commit ae8a3c61d5
1 file changed
+6 -1
+6 -1
View File
@@ -68,8 +68,8 @@ namespace VocaluxeLib.Draw
//Free textures that are no longer referenced //Free textures that are no longer referenced
CTextureRef tmp = this; CTextureRef tmp = this;
CBase.Drawing.RemoveTexture(ref tmp); CBase.Drawing.RemoveTexture(ref tmp);
_SetRemoved();
} }
SetRemoved();
} }
/// <summary> /// <summary>
@@ -80,6 +80,11 @@ namespace VocaluxeLib.Draw
{ {
if (ID < 0) if (ID < 0)
throw new ObjectDisposedException(GetType().Name); throw new ObjectDisposedException(GetType().Name);
_SetRemoved();
}
private void _SetRemoved()
{
ID = -1; ID = -1;
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }