From 4f9477910224c28c548dd4dab50657992b349cb1 Mon Sep 17 00:00:00 2001 From: Michael Winsor Date: Thu, 17 Mar 2022 16:35:35 -0600 Subject: [PATCH] [Graphics] - Fixed a bug in texture cache where calling Clear after disposing throw an exception. --- Gorgon/Gorgon.Graphics.Core/Textures/GorgonTextureCache.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Gorgon/Gorgon.Graphics.Core/Textures/GorgonTextureCache.cs b/Gorgon/Gorgon.Graphics.Core/Textures/GorgonTextureCache.cs index af40aa80a..34dcd44b3 100644 --- a/Gorgon/Gorgon.Graphics.Core/Textures/GorgonTextureCache.cs +++ b/Gorgon/Gorgon.Graphics.Core/Textures/GorgonTextureCache.cs @@ -554,6 +554,11 @@ public int GetUserCount(T texture) /// public void Clear() { + if ((_cache is null) || (_cache.Values.Count == 0) || (_cacheLock is null)) + { + return; + } + try { _cacheLock.Wait();