diff options
| author | iwubcode <iwubcode@users.noreply.github.com> | 2021-02-02 23:02:41 -0600 |
|---|---|---|
| committer | iwubcode <iwubcode@users.noreply.github.com> | 2021-02-11 19:18:38 -0600 |
| commit | 0a9c764dc4973cf17e982ee142b9929690b1aa73 (patch) | |
| tree | a3e31fa7f31eeb045e577762e174a0d34fc189ef /Source/Core | |
| parent | 0f29e36440f0c1fc14e104577345779687593da1 (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')
| -rw-r--r-- | Source/Core/VideoCommon/HiresTextures.cpp | 14 |
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(); } |
