internal void Remove(ScaledTexture scaledTexture, Texture2D texture) { try { lock (texture.Meta()) { var Map = texture.Meta().SpriteTable; using (Lock.Exclusive) { try { ScaledTextureReferences.Purge(); var removeElements = new List <ScaledTexture>(); foreach (var element in ScaledTextureReferences) { if (element == scaledTexture) { removeElements.Add(element); } } foreach (var element in removeElements) { ScaledTextureReferences.Remove(element); } } catch { } Map.Clear(); } } } finally { if (scaledTexture.Texture != null && !scaledTexture.Texture.IsDisposed) { Debug.TraceLn($"Disposing Active HD Texture: {scaledTexture.SafeName()}"); //scaledTexture.Texture.Dispose(); } } }