Merge "(Vector) Fix memory leak" into devel/master
authorHeeyong Song <heeyong.song@samsung.com>
Tue, 16 Jun 2020 08:05:53 +0000 (08:05 +0000)
committerGerrit Code Review <gerrit@review>
Tue, 16 Jun 2020 08:05:53 +0000 (08:05 +0000)
dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp
dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.h

index 6072ce5..55968e1 100644 (file)
@@ -74,7 +74,8 @@ VectorAnimationTask::VectorAnimationTask( VisualFactoryCache& factoryCache, cons
   mForward( true ),
   mUpdateFrameNumber( false ),
   mNeedAnimationFinishedTrigger( true ),
-  mAnimationDataUpdated( false )
+  mAnimationDataUpdated( false ),
+  mDestroyTask( false )
 {
   Initialize();
 }
@@ -95,6 +96,8 @@ void VectorAnimationTask::Finalize()
   }
 
   mVectorRenderer.Finalize();
+
+  mDestroyTask = true;
 }
 
 void VectorAnimationTask::SetRenderer( Renderer renderer )
@@ -372,6 +375,15 @@ bool VectorAnimationTask::Rasterize()
   bool stopped = false;
   uint32_t currentFrame;
 
+  {
+    ConditionalWait::ScopedLock lock( mConditionalWait );
+    if( mDestroyTask )
+    {
+      // The task will be destroyed. We don't need rasterization.
+      return false;
+    }
+  }
+
   ApplyAnimationData();
 
   if( mPlayState == PlayState::PLAYING && mUpdateFrameNumber )
index 8e91788..79c3ee2 100644 (file)
@@ -314,7 +314,7 @@ private:
   bool                                   mUpdateFrameNumber;
   bool                                   mNeedAnimationFinishedTrigger;
   bool                                   mAnimationDataUpdated;
-
+  bool                                   mDestroyTask;
 };
 
 } // namespace Internal