Reset AsyncTask what we don't need anymore 96/290396/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Fri, 24 Mar 2023 03:24:15 +0000 (12:24 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Fri, 24 Mar 2023 03:24:15 +0000 (12:24 +0900)
Change-Id: Iffdf810c296f793fd6b0bb437e995baa5a1d2009
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali-toolkit/internal/controls/canvas-view/canvas-view-impl.cpp
dali-toolkit/internal/visuals/svg/svg-visual.cpp

index 2fff921..e9c8a97 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -205,6 +205,8 @@ void CanvasView::ApplyRasterizedImage(CanvasRendererRasterizingTaskPtr task)
     }
   }
 
+  mRasterizingTask.Reset(); // We don't need it anymore
+
   //If there are accumulated changes to CanvasRenderer during Rasterize, Rasterize once again.
   if(mCanvasRenderer && mCanvasRenderer.IsCanvasChanged())
   {
index 265c2fe..8fcbf52 100644 (file)
@@ -109,7 +109,11 @@ void SvgVisual::OnInitialize()
   if(IsSynchronousLoadingRequired() && mImageUrl.IsLocalResource())
   {
     mLoadingTask->Process();
-    mLoadingTask.Reset(); // We don't need it now
+    if(!mLoadingTask->HasSucceeded())
+    {
+      mLoadFailed = true;
+    }
+    mLoadingTask.Reset(); // We don't need it anymore.
   }
   else
   {
@@ -319,7 +323,7 @@ void SvgVisual::AddRasterizationTask(const Vector2& size)
     {
       mRasterizingTask->Process();
       ApplyRasterizedImage(mRasterizingTask);
-      mRasterizingTask.Reset(); // We don't need it now
+      mRasterizingTask.Reset(); // We don't need it anymore.
     }
     else
     {
@@ -421,6 +425,16 @@ void SvgVisual::ApplyRasterizedImage(SvgTaskPtr task)
 
     ResourceReady(Toolkit::Visual::ResourceStatus::FAILED);
   }
+
+  // We don't need to keep tasks anymore. reset now.
+  if(task == mLoadingTask)
+  {
+    mLoadingTask.Reset();
+  }
+  if(task == mRasterizingTask)
+  {
+    mRasterizingTask.Reset();
+  }
 }
 
 void SvgVisual::OnSetTransform()