diff --git a/core/rend/gles/CustomTexture.cpp b/core/rend/gles/CustomTexture.cpp index af6ad2df6..079530995 100644 --- a/core/rend/gles/CustomTexture.cpp +++ b/core/rend/gles/CustomTexture.cpp @@ -54,6 +54,7 @@ void CustomTexture::LoaderThread() texture->custom_height = height; texture->custom_image_data = image_data; } + texture->custom_load_in_progress = false; } wakeup_thread.Wait(); diff --git a/core/rend/gles/gles.h b/core/rend/gles/gles.h index 6e0c169c2..423ded1e3 100755 --- a/core/rend/gles/gles.h +++ b/core/rend/gles/gles.h @@ -270,6 +270,7 @@ struct TextureCacheData u8* custom_image_data; // loaded custom image data u32 custom_width; u32 custom_height; + bool custom_load_in_progress; void PrintTextureName(); @@ -285,5 +286,5 @@ struct TextureCacheData void CheckCustomTexture(); //true if : dirty or paletted texture and hashes don't match bool NeedsUpdate(); - void Delete(); + bool Delete(); }; diff --git a/core/rend/gles/gltex.cpp b/core/rend/gles/gltex.cpp index 2e4239f15..9b42df403 100644 --- a/core/rend/gles/gltex.cpp +++ b/core/rend/gles/gltex.cpp @@ -408,6 +408,7 @@ void TextureCacheData::Update() } if (settings.rend.CustomTextures) { + custom_load_in_progress = true; custom_texture.LoadCustomTextureAsync(this); } @@ -560,8 +561,11 @@ bool TextureCacheData::NeedsUpdate() { return rc; } -void TextureCacheData::Delete() +bool TextureCacheData::Delete() { + if (custom_load_in_progress) + return false; + if (pData) { #if FEAT_HAS_SOFTREND _mm_free(pData); @@ -579,6 +583,8 @@ void TextureCacheData::Delete() lock_block=0; if (custom_image_data != NULL) delete [] custom_image_data; + + return true; } @@ -951,10 +957,11 @@ void CollectCleanup() { } for (size_t i=0; i