(Scene3D) Guard cache impl will not be re-created at terminate case 73/304673/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Tue, 23 Jan 2024 04:12:59 +0000 (13:12 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Tue, 23 Jan 2024 04:12:59 +0000 (13:12 +0900)
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 <eunkiki.hong@samsung.com>
dali-scene3d/internal/common/image-resource-loader.cpp

index bc1a21d..3d3ab93 100644 (file)
@@ -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.