From df96c394091fc2a5bc0c546cfc26966e7c57bacd Mon Sep 17 00:00:00 2001 From: Stephan Sundermann Date: Fri, 16 Mar 2012 14:08:12 +0100 Subject: [PATCH] null textures will no longer get disposed --- Vocaluxe/Lib/Draw/CDirect3D.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs index 65a9444f..49942b2d 100644 --- a/Vocaluxe/Lib/Draw/CDirect3D.cs +++ b/Vocaluxe/Lib/Draw/CDirect3D.cs @@ -471,7 +471,8 @@ namespace Vocaluxe.Lib.Draw //Dispose all textures for (int i = 0; i < _D3DTextures.Count; i++) { - _D3DTextures[i].Dispose(); + if(_D3DTextures[i] != null) + _D3DTextures[i].Dispose(); } TexturedColoredVertex.GetDeclaration(_Device).Dispose(); _VertexBuffer.Dispose(); @@ -933,13 +934,13 @@ namespace Vocaluxe.Lib.Draw { for (int i = 0; i < _Textures.Count; i++) { - if (_Textures[i].index == Texture.index) + if (_Textures[i].index == Texture.index && _D3DTextures[i] != null) { _D3DTextures[Texture.index].Dispose(); + _D3DTextures[Texture.index] = null; _Textures.RemoveAt(i); Texture.index = -1; Texture.ID = -1; - break; } } }