summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/HiresTextures.cpp
diff options
context:
space:
mode:
authoriwubcode <iwubcode@users.noreply.github.com>2021-02-02 23:02:41 -0600
committeriwubcode <iwubcode@users.noreply.github.com>2021-02-11 19:18:38 -0600
commit0a9c764dc4973cf17e982ee142b9929690b1aa73 (patch)
treea3e31fa7f31eeb045e577762e174a0d34fc189ef /Source/Core/VideoCommon/HiresTextures.cpp
parent0f29e36440f0c1fc14e104577345779687593da1 (diff)
VideoCommon: Join the prefetch thread before clearing to avoid a potential crash that can occur by multiple threads touching a single resource
Diffstat (limited to 'Source/Core/VideoCommon/HiresTextures.cpp')
-rw-r--r--Source/Core/VideoCommon/HiresTextures.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/Source/Core/VideoCommon/HiresTextures.cpp b/Source/Core/VideoCommon/HiresTextures.cpp
index cbb2566470..d55eadf022 100644
--- a/Source/Core/VideoCommon/HiresTextures.cpp
+++ b/Source/Core/VideoCommon/HiresTextures.cpp
@@ -56,14 +56,7 @@ void HiresTexture::Init()
void HiresTexture::Shutdown()
{
- if (s_prefetcher.joinable())
- {
- s_textureCacheAbortLoading.Set();
- s_prefetcher.join();
- }
-
- s_textureMap.clear();
- s_textureCache.clear();
+ Clear();
}
void HiresTexture::Update()
@@ -147,6 +140,11 @@ void HiresTexture::Update()
void HiresTexture::Clear()
{
+ if (s_prefetcher.joinable())
+ {
+ s_textureCacheAbortLoading.Set();
+ s_prefetcher.join();
+ }
s_textureMap.clear();
s_textureCache.clear();
}