(NPatchVisual) Ensure we're still running when removing in the destructor 89/255789/1
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 23 Mar 2021 17:11:51 +0000 (17:11 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 23 Mar 2021 17:11:51 +0000 (17:11 +0000)
Change-Id: I039bcd2e7630a2b3782ad88693b24176aeedbf0b

dali-toolkit/internal/visuals/npatch/npatch-visual.cpp

index 4e95dfe2b4ebabdf59c828a453a1e23738fe7211..bb8571da9f19dda660cc8bf0984cefcd0b2e4476 100644 (file)
@@ -22,6 +22,7 @@
 #include <dali/devel-api/adaptor-framework/image-loading.h>
 #include <dali/devel-api/rendering/renderer-devel.h>
 #include <dali/integration-api/debug.h>
+#include <dali/devel-api/common/stage.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
@@ -364,7 +365,7 @@ NPatchVisual::NPatchVisual(VisualFactoryCache& factoryCache, ImageVisualShaderFa
 
 NPatchVisual::~NPatchVisual()
 {
-  if((mId != NPatchData::INVALID_NPATCH_DATA_ID) && (mReleasePolicy != Toolkit::ImageVisual::ReleasePolicy::NEVER))
+  if(Stage::IsInstalled() && (mId != NPatchData::INVALID_NPATCH_DATA_ID) && (mReleasePolicy != Toolkit::ImageVisual::ReleasePolicy::NEVER))
   {
     mLoader.Remove(mId, this);
     mId = NPatchData::INVALID_NPATCH_DATA_ID;