From fa16a5b6dc5316ef89ba62a60e26d871c03e1bf4 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Tue, 23 Jan 2024 13:12:59 +0900 Subject: [PATCH] (Scene3D) Guard cache impl will not be re-created at terminate case Since LifecycleController could be called first before Model / ModelCache destroy, re-create the image resource cache at terminate time was possible. Since we don't check the validation of this item, it will make crash. So let we ensure that we call those API under same thread with adaptor. Change-Id: I995c509f070b56f99214689e5a9f3e66514d5f91 Signed-off-by: Eunki, Hong --- dali-scene3d/internal/common/image-resource-loader.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dali-scene3d/internal/common/image-resource-loader.cpp b/dali-scene3d/internal/common/image-resource-loader.cpp index bc1a21d..3d3ab93 100644 --- a/dali-scene3d/internal/common/image-resource-loader.cpp +++ b/dali-scene3d/internal/common/image-resource-loader.cpp @@ -552,7 +552,7 @@ Dali::Texture GetEmptyCubeTextureWhiteRGB() Dali::Texture GetCachedTexture(Dali::PixelData pixelData, bool mipmapRequired) { - if(SupportPixelDataCache(pixelData)) + if(Dali::Adaptor::IsAvailable() && SupportPixelDataCache(pixelData)) { return GetCacheImpl()->GetOrCreateCachedTexture(pixelData, mipmapRequired); } @@ -564,12 +564,18 @@ Dali::Texture GetCachedTexture(Dali::PixelData pixelData, bool mipmapRequired) void RequestGarbageCollect(bool fullCollect) { - GetCacheImpl()->RequestGarbageCollect(fullCollect); + if(DALI_LIKELY(Dali::Adaptor::IsAvailable())) + { + GetCacheImpl()->RequestGarbageCollect(fullCollect); + } } void EnsureResourceLoaderCreated() { - GetCacheImpl(); + if(DALI_LIKELY(Dali::Adaptor::IsAvailable())) + { + GetCacheImpl(); + } } // Can be called by worker thread. -- 2.7.4