VideoCommon: Join the prefetch thread before clearing to avoid a potential crash that can occur by multiple threads touching a single resource

This commit is contained in:
iwubcode 2021-02-02 23:02:41 -06:00
parent 0f29e36440
commit 0a9c764dc4

View File

@ -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();
}