[Tizen](Vector) Fix crash issues 14/220514/1
authorHeeyong Song <heeyong.song@samsung.com>
Fri, 29 Nov 2019 08:11:30 +0000 (17:11 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Thu, 19 Dec 2019 05:21:38 +0000 (14:21 +0900)
Change-Id: I881285162317da9b095b0e29dabba1936b8f4b31

dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp
dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp

index 4a73a08..f5d707f 100644 (file)
@@ -118,7 +118,8 @@ AnimatedVectorImageVisual::AnimatedVectorImageVisual( VisualFactoryCache& factor
 
 AnimatedVectorImageVisual::~AnimatedVectorImageVisual()
 {
-  // Finalize animation task in the main thread
+  // Finalize animation task and disconnect the signal in the main thread
+  mVectorAnimationTask->UploadCompletedSignal().Disconnect( this, &AnimatedVectorImageVisual::OnUploadCompleted );
   mVectorAnimationTask->Finalize();
 }
 
index 213051f..7cfce6b 100644 (file)
@@ -95,6 +95,8 @@ VectorAnimationTask::~VectorAnimationTask()
 
 void VectorAnimationTask::Finalize()
 {
+  ConditionalWait::ScopedLock lock( mConditionalWait );
+
   // Release some objects in the main thread
   if( mAnimationFinishedTrigger )
   {
@@ -417,7 +419,7 @@ void VectorAnimationTask::Initialize()
 
 bool VectorAnimationTask::Rasterize()
 {
-  bool stopped = false, needAnimationFinishedTrigger;
+  bool stopped = false, needAnimationFinishedTrigger, resourceReady;
   uint32_t currentFrame, startFrame, endFrame;
   int32_t loopCount, currentLoopCount;
   PlayState playState;
@@ -437,6 +439,7 @@ bool VectorAnimationTask::Rasterize()
     currentLoopCount = mCurrentLoop;
     needAnimationFinishedTrigger = mNeedAnimationFinishedTrigger;
     playState = mPlayState;
+    resourceReady = mResourceReady;
 
     mResourceReady = true;
     mCurrentFrameUpdated = false;
@@ -511,11 +514,19 @@ bool VectorAnimationTask::Rasterize()
     {
       DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::Rasterize: Rendering failed. Try again later.[%d] [%p]\n", currentFrame, this );
       mUpdateFrameNumber = false;
+
+      if( !resourceReady )
+      {
+        ConditionalWait::ScopedLock lock( mConditionalWait );
+        mResourceReady = false;
+      }
     }
   }
 
   if( stopped && renderSuccess )
   {
+    ConditionalWait::ScopedLock lock( mConditionalWait );
+
     mPlayState = PlayState::STOPPED;
     mForward = true;
     mCurrentLoop = 0;