Fix bug with removing a removed texture reference

This commit is contained in:
Flamefire committed 2014-09-25 16:22:49 +02:00
1 parent f0b227798e
commit a06e5066e9
1 file changed
+16 -13
+16 -13
View File
@@ -882,24 +882,27 @@ namespace Vocaluxe.Lib.Draw
{ {
if (textureRef == null) if (textureRef == null)
return; return;
if (_MainThreadID != Thread.CurrentThread.ManagedThreadId) if (textureRef.ID > 0)
{ {
lock (_TextureQueue) if (_MainThreadID != Thread.CurrentThread.ManagedThreadId)
{ {
_TextureQueue.Enqueue(new STextureQueue(textureRef, EQueueAction.Delete, null)); lock (_TextureQueue)
{
_TextureQueue.Enqueue(new STextureQueue(textureRef, EQueueAction.Delete, null));
}
textureRef = null;
return;
} }
textureRef = null; lock (_Textures)
return;
}
lock (_Textures)
{
TTextureType t;
if (_Textures.TryGetValue(textureRef.ID, out t))
{ {
_DisposeTexture(t); TTextureType t;
_Textures.Remove(textureRef.ID); if (_Textures.TryGetValue(textureRef.ID, out t))
{
_DisposeTexture(t);
_Textures.Remove(textureRef.ID);
}
textureRef.SetRemoved();
} }
textureRef.SetRemoved();
} }
textureRef = null; textureRef = null;
} }