[Tizen] Print log if worker thread destruction occured for UI items. 15/314115/1 accepted/tizen_8.0_unified accepted/tizen/8.0/unified/20240709.165308
authorEunki, Hong <eunkiki.hong@samsung.com>
Wed, 3 Jul 2024 11:24:22 +0000 (20:24 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Fri, 5 Jul 2024 08:40:20 +0000 (17:40 +0900)
Change-Id: I15db9dd5d6763b403b4b5015c95e3491c18443dc
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
31 files changed:
automated-tests/src/dali/utc-Dali-Actor.cpp
automated-tests/src/dali/utc-Dali-Animation.cpp
automated-tests/src/dali/utc-Dali-FrameBuffer.cpp
automated-tests/src/dali/utc-Dali-Geometry.cpp
automated-tests/src/dali/utc-Dali-GestureDetector.cpp
automated-tests/src/dali/utc-Dali-RenderTask.cpp
automated-tests/src/dali/utc-Dali-RenderTaskList.cpp
automated-tests/src/dali/utc-Dali-Renderer.cpp
automated-tests/src/dali/utc-Dali-Sampler.cpp
automated-tests/src/dali/utc-Dali-Scene.cpp
automated-tests/src/dali/utc-Dali-Shader.cpp
automated-tests/src/dali/utc-Dali-Texture.cpp
automated-tests/src/dali/utc-Dali-TextureSet.cpp
automated-tests/src/dali/utc-Dali-VertexBuffer.cpp
dali/internal/event/actors/actor-impl.cpp
dali/internal/event/actors/layer-impl.cpp
dali/internal/event/animation/animation-impl.cpp
dali/internal/event/animation/constraint-base.cpp
dali/internal/event/common/object-impl.cpp
dali/internal/event/common/scene-impl.cpp
dali/internal/event/events/gesture-detector-impl.cpp
dali/internal/event/render-tasks/render-task-impl.cpp
dali/internal/event/render-tasks/render-task-list-impl.cpp
dali/internal/event/rendering/frame-buffer-impl.cpp
dali/internal/event/rendering/geometry-impl.cpp
dali/internal/event/rendering/renderer-impl.cpp
dali/internal/event/rendering/sampler-impl.cpp
dali/internal/event/rendering/shader-impl.cpp
dali/internal/event/rendering/texture-impl.cpp
dali/internal/event/rendering/texture-set-impl.cpp
dali/internal/event/rendering/vertex-buffer-impl.cpp

index f08e19d..8597d18 100644 (file)
@@ -21,6 +21,7 @@
 #include <dali-test-suite-utils.h>
 #include <dali/devel-api/actors/actor-devel.h>
 #include <dali/devel-api/common/capabilities.h>
+#include <dali/devel-api/threading/thread.h>
 #include <dali/integration-api/debug.h>
 #include <dali/integration-api/events/hover-event-integ.h>
 #include <dali/integration-api/events/touch-event-integ.h>
@@ -14652,3 +14653,42 @@ int UtcDaliActorDispatchHoverMotionPropertyN(void)
   }
   END_TEST;
 }
+
+int UtcDaliActorDestructWorkerThreadN(void)
+{
+  TestApplication application;
+  tet_infoline("UtcDaliActorDestructWorkerThreadN Test, for line coverage");
+
+  try
+  {
+    class TestThread : public Thread
+    {
+    public:
+      virtual void Run()
+      {
+        tet_printf("Run TestThread\n");
+        // Destruct at worker thread.
+        mActor.Reset();
+      }
+
+      Dali::Actor mActor;
+    };
+    TestThread thread;
+
+    Dali::Actor actor = Dali::Actor::New();
+    thread.mActor     = std::move(actor);
+    actor.Reset();
+
+    thread.Start();
+
+    thread.Join();
+  }
+  catch(...)
+  {
+  }
+
+  // Always success
+  DALI_TEST_CHECK(true);
+
+  END_TEST;
+}
index 6adfc79..137c5d0 100644 (file)
@@ -19,6 +19,7 @@
 #include <dali/devel-api/actors/actor-devel.h>
 #include <dali/devel-api/animation/animation-devel.h>
 #include <dali/devel-api/animation/key-frames-devel.h>
+#include <dali/devel-api/threading/thread.h>
 #include <dali/public-api/dali-core.h>
 #include <stdlib.h>
 
@@ -16672,4 +16673,43 @@ int UtcDaliAnimationPlayAfterStopGetState(void)
   }
 
   END_TEST;
-}
\ No newline at end of file
+}
+
+int UtcDaliAnimationDestructWorkerThreadN(void)
+{
+  TestApplication application;
+  tet_infoline("UtcDaliAnimationDestructWorkerThreadN Test, for line coverage");
+
+  try
+  {
+    class TestThread : public Thread
+    {
+    public:
+      virtual void Run()
+      {
+        tet_printf("Run TestThread\n");
+        // Destruct at worker thread.
+        mAnimation.Reset();
+      }
+
+      Dali::Animation mAnimation;
+    };
+    TestThread thread;
+
+    Dali::Animation animation = Dali::Animation::New(0);
+    thread.mAnimation         = std::move(animation);
+    animation.Reset();
+
+    thread.Start();
+
+    thread.Join();
+  }
+  catch(...)
+  {
+  }
+
+  // Always success
+  DALI_TEST_CHECK(true);
+
+  END_TEST;
+}
index dfb0db1..e0725ad 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -17,6 +17,7 @@
 
 #include <dali-test-suite-utils.h>
 #include <dali/devel-api/rendering/frame-buffer-devel.h>
+#include <dali/devel-api/threading/thread.h>
 #include <dali/public-api/dali-core.h>
 using namespace Dali;
 
@@ -33,6 +34,8 @@ void framebuffer_set_cleanup(void)
   test_return_value = TET_PASS;
 }
 
+namespace
+{
 RenderTask CreateRenderTask(TestApplication& application,
                             FrameBuffer      framebuffer)
 {
@@ -61,6 +64,7 @@ RenderTask CreateRenderTask(TestApplication& application,
 
   return newTask;
 }
+} // namespace
 
 int UtcDaliFrameBufferNew01(void)
 {
@@ -768,3 +772,42 @@ int UtcDaliFrameBufferAttachColorTextureNegative02(void)
   }
   END_TEST;
 }
+
+int UtcDaliFrameBufferDestructWorkerThreadN(void)
+{
+  TestApplication application;
+  tet_infoline("UtcDaliFrameBufferDestructWorkerThreadN Test, for line coverage");
+
+  try
+  {
+    class TestThread : public Thread
+    {
+    public:
+      virtual void Run()
+      {
+        tet_printf("Run TestThread\n");
+        // Destruct at worker thread.
+        mFrameBuffer.Reset();
+      }
+
+      Dali::FrameBuffer mFrameBuffer;
+    };
+    TestThread thread;
+
+    Dali::FrameBuffer frameBuffer = Dali::FrameBuffer::New(100, 100);
+    thread.mFrameBuffer           = std::move(frameBuffer);
+    frameBuffer.Reset();
+
+    thread.Start();
+
+    thread.Join();
+  }
+  catch(...)
+  {
+  }
+
+  // Always success
+  DALI_TEST_CHECK(true);
+
+  END_TEST;
+}
index bb1205d..437ea1b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -16,6 +16,7 @@
  */
 
 #include <dali-test-suite-utils.h>
+#include <dali/devel-api/threading/thread.h>
 #include <dali/public-api/dali-core.h>
 
 using namespace Dali;
@@ -774,3 +775,42 @@ int UtcDaliGeometryGetTypeNegative(void)
   }
   END_TEST;
 }
+
+int UtcDaliGeometryDestructWorkerThreadN(void)
+{
+  TestApplication application;
+  tet_infoline("UtcDaliGeometryDestructWorkerThreadN Test, for line coverage");
+
+  try
+  {
+    class TestThread : public Thread
+    {
+    public:
+      virtual void Run()
+      {
+        tet_printf("Run TestThread\n");
+        // Destruct at worker thread.
+        mGeometry.Reset();
+      }
+
+      Dali::Geometry mGeometry;
+    };
+    TestThread thread;
+
+    Dali::Geometry geometry = Dali::Geometry::New();
+    thread.mGeometry        = std::move(geometry);
+    geometry.Reset();
+
+    thread.Start();
+
+    thread.Join();
+  }
+  catch(...)
+  {
+  }
+
+  // Always success
+  DALI_TEST_CHECK(true);
+
+  END_TEST;
+}
index e12bbdb..c064f8d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
  */
 
 #include <dali-test-suite-utils.h>
-#include <dali/public-api/dali-core.h>
+#include <dali/devel-api/threading/thread.h>
 #include <dali/integration-api/events/touch-event-integ.h>
 #include <dali/integration-api/events/touch-integ.h>
 #include <dali/integration-api/render-task-list-integ.h>
+#include <dali/internal/event/events/tap-gesture/tap-gesture-detector-impl.h>
 #include <dali/internal/event/events/touch-event-impl.h>
 #include <dali/internal/event/render-tasks/render-task-impl.h>
-#include <dali/internal/event/events/tap-gesture/tap-gesture-detector-impl.h>
+#include <dali/public-api/dali-core.h>
 #include <stdlib.h>
 
 #include <algorithm>
@@ -125,8 +126,7 @@ Integration::TouchEvent GenerateDoubleTouch(PointState::Type stateA, const Vecto
   return touchEvent;
 }
 
-}
-
+} // namespace
 
 int UtcDaliGestureDetectorConstructorN(void)
 {
@@ -598,10 +598,10 @@ int UtcDaliGestureDetectorRegisterProperty(void)
 
 int UtcDaliGestureDetectorCancelProcessing(void)
 {
-  TestApplication application;
-  Integration::Scene scene   = application.GetScene();
-  RenderTaskList   taskList  = scene.GetRenderTaskList();
-  Dali::RenderTask task      = taskList.GetTask(0);
+  TestApplication    application;
+  Integration::Scene scene    = application.GetScene();
+  RenderTaskList     taskList = scene.GetRenderTaskList();
+  Dali::RenderTask   task     = taskList.GetTask(0);
 
   LongPressGestureDetector longDetector     = LongPressGestureDetector::New();
   TapGestureDetector       tapDetector      = TapGestureDetector::New();
@@ -646,13 +646,12 @@ int UtcDaliGestureDetectorCancelProcessing(void)
   TestTriggerLongPress(application);
   longDetector.CancelAllOtherGestureDetectors();
 
-
   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
   DALI_TEST_EQUALS(false, tData.functorCalled, TEST_LOCATION);
   data.Reset();
   tData.Reset();
 
-  tp = GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 1, 650);
+  tp             = GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 1, 650);
   touchEventImpl = new Internal::TouchEvent(650);
   touchEventImpl->AddPoint(tp.GetPoint(0));
   touchEventImpl->SetRenderTask(task);
@@ -670,7 +669,7 @@ int UtcDaliGestureDetectorCancelProcessing(void)
 
   longDetector.SetTouchesRequired(2, 2);
 
-  tp = GenerateDoubleTouch(PointState::DOWN, Vector2(2.0f, 20.0f), PointState::DOWN, Vector2(38.0f, 20.0f), 100);
+  tp             = GenerateDoubleTouch(PointState::DOWN, Vector2(2.0f, 20.0f), PointState::DOWN, Vector2(38.0f, 20.0f), 100);
   touchEventImpl = new Internal::TouchEvent(100);
   touchEventImpl->AddPoint(tp.GetPoint(0));
   touchEventImpl->AddPoint(tp.GetPoint(1));
@@ -684,7 +683,7 @@ int UtcDaliGestureDetectorCancelProcessing(void)
 
   pinchDetector.CancelAllOtherGestureDetectors();
 
-  tp = GenerateDoubleTouch(PointState::MOTION, Vector2(10.0f, 20.0f), PointState::MOTION, Vector2(30.0f, 20.0f), 150);
+  tp             = GenerateDoubleTouch(PointState::MOTION, Vector2(10.0f, 20.0f), PointState::MOTION, Vector2(30.0f, 20.0f), 150);
   touchEventImpl = new Internal::TouchEvent(150);
   touchEventImpl->AddPoint(tp.GetPoint(0));
   touchEventImpl->AddPoint(tp.GetPoint(1));
@@ -696,8 +695,7 @@ int UtcDaliGestureDetectorCancelProcessing(void)
   pinchDetector.HandleEvent(actor, touchEventHandle);
   rotationDetector.HandleEvent(actor, touchEventHandle);
 
-
-  tp = GenerateDoubleTouch(PointState::MOTION, Vector2(10.0f, 20.0f), PointState::MOTION, Vector2(30.0f, 20.0f), 200);
+  tp             = GenerateDoubleTouch(PointState::MOTION, Vector2(10.0f, 20.0f), PointState::MOTION, Vector2(30.0f, 20.0f), 200);
   touchEventImpl = new Internal::TouchEvent(200);
   touchEventImpl->AddPoint(tp.GetPoint(0));
   touchEventImpl->AddPoint(tp.GetPoint(1));
@@ -709,8 +707,7 @@ int UtcDaliGestureDetectorCancelProcessing(void)
   pinchDetector.HandleEvent(actor, touchEventHandle);
   rotationDetector.HandleEvent(actor, touchEventHandle);
 
-
-  tp = GenerateDoubleTouch(PointState::MOTION, Vector2(10.0f, 20.0f), PointState::MOTION, Vector2(30.0f, 20.0f), 250);
+  tp             = GenerateDoubleTouch(PointState::MOTION, Vector2(10.0f, 20.0f), PointState::MOTION, Vector2(30.0f, 20.0f), 250);
   touchEventImpl = new Internal::TouchEvent(250);
   touchEventImpl->AddPoint(tp.GetPoint(0));
   touchEventImpl->AddPoint(tp.GetPoint(1));
@@ -722,8 +719,7 @@ int UtcDaliGestureDetectorCancelProcessing(void)
   pinchDetector.HandleEvent(actor, touchEventHandle);
   rotationDetector.HandleEvent(actor, touchEventHandle);
 
-
-  tp = GenerateDoubleTouch(PointState::MOTION, Vector2(10.0f, 20.0f), PointState::MOTION, Vector2(30.0f, 20.0f), 300);
+  tp             = GenerateDoubleTouch(PointState::MOTION, Vector2(10.0f, 20.0f), PointState::MOTION, Vector2(30.0f, 20.0f), 300);
   touchEventImpl = new Internal::TouchEvent(300);
   touchEventImpl->AddPoint(tp.GetPoint(0));
   touchEventImpl->AddPoint(tp.GetPoint(1));
@@ -735,8 +731,7 @@ int UtcDaliGestureDetectorCancelProcessing(void)
   pinchDetector.HandleEvent(actor, touchEventHandle);
   rotationDetector.HandleEvent(actor, touchEventHandle);
 
-
-  tp = GenerateDoubleTouch(PointState::UP, Vector2(10.0f, 20.0f), PointState::UP, Vector2(30.0f, 20.0f), 350);
+  tp             = GenerateDoubleTouch(PointState::UP, Vector2(10.0f, 20.0f), PointState::UP, Vector2(30.0f, 20.0f), 350);
   touchEventImpl = new Internal::TouchEvent(350);
   touchEventImpl->AddPoint(tp.GetPoint(0));
   touchEventImpl->AddPoint(tp.GetPoint(1));
@@ -757,3 +752,42 @@ int UtcDaliGestureDetectorCancelProcessing(void)
 
   END_TEST;
 }
+
+int UtcDaliGestureDetectorDestructWorkerThreadN(void)
+{
+  TestApplication application;
+  tet_infoline("UtcDaliGestureDetectorDestructWorkerThreadN Test, for line coverage");
+
+  try
+  {
+    class TestThread : public Thread
+    {
+    public:
+      virtual void Run()
+      {
+        tet_printf("Run TestThread\n");
+        // Destruct at worker thread.
+        mGestureDetector.Reset();
+      }
+
+      Dali::GestureDetector mGestureDetector;
+    };
+    TestThread thread;
+
+    GestureDetector detector = PanGestureDetector::New();
+    thread.mGestureDetector  = std::move(detector);
+    detector.Reset();
+
+    thread.Start();
+
+    thread.Join();
+  }
+  catch(...)
+  {
+  }
+
+  // Always success
+  DALI_TEST_CHECK(true);
+
+  END_TEST;
+}
index cf7bd97..087c6ea 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -17,6 +17,7 @@
 
 #include <dali-test-suite-utils.h>
 #include <dali/devel-api/events/hit-test-algorithm.h>
+#include <dali/devel-api/threading/thread.h>
 #include <dali/integration-api/debug.h>
 #include <dali/public-api/dali-core.h>
 #include <mesh-builder.h>
@@ -4274,7 +4275,7 @@ int UtcDaliRenderTaskOrderIndex01(void)
   RenderTask     renderTask1    = renderTaskList.CreateTask();
 
   application.SendNotification();
-  uint32_t       answer1[2]     = {0u, 0u};
+  uint32_t answer1[2] = {0u, 0u};
   DALI_TEST_EQUALS(2, renderTaskList.GetTaskCount(), TEST_LOCATION);
   for(uint32_t i = 0; i < 2; ++i)
   {
@@ -4356,19 +4357,19 @@ int UtcDaliRenderTaskOrderIndex02(void)
   RenderTask     renderTask1    = renderTaskList.CreateTask();
   application.SendNotification();
   DALI_TEST_EQUALS(renderTask1, renderTaskList.GetTask(1u), TEST_LOCATION);
-  
-  RenderTask     renderTask2    = renderTaskList.CreateTask();
+
+  RenderTask renderTask2 = renderTaskList.CreateTask();
   application.SendNotification();
   DALI_TEST_EQUALS(renderTask1, renderTaskList.GetTask(1u), TEST_LOCATION);
   DALI_TEST_EQUALS(renderTask2, renderTaskList.GetTask(2u), TEST_LOCATION);
 
-  RenderTask     renderTask3    = renderTaskList.CreateTask();
+  RenderTask renderTask3 = renderTaskList.CreateTask();
   application.SendNotification();
   DALI_TEST_EQUALS(renderTask1, renderTaskList.GetTask(1u), TEST_LOCATION);
   DALI_TEST_EQUALS(renderTask2, renderTaskList.GetTask(2u), TEST_LOCATION);
   DALI_TEST_EQUALS(renderTask3, renderTaskList.GetTask(3u), TEST_LOCATION);
 
-  RenderTask     renderTask4    = renderTaskList.CreateTask();
+  RenderTask renderTask4 = renderTaskList.CreateTask();
   application.SendNotification();
   DALI_TEST_EQUALS(renderTask1, renderTaskList.GetTask(1u), TEST_LOCATION);
   DALI_TEST_EQUALS(renderTask2, renderTaskList.GetTask(2u), TEST_LOCATION);
@@ -4402,10 +4403,56 @@ int UtcDaliRenderTaskGetRenderTaskId(void)
   DALI_TEST_CHECK(renderTask1.GetRenderTaskId() != 0u);
   DALI_TEST_CHECK(renderTask2.GetRenderTaskId() != 0u);
   DALI_TEST_CHECK(renderTask3.GetRenderTaskId() != 0u);
-  
+
   DALI_TEST_CHECK(renderTask1.GetRenderTaskId() != renderTask2.GetRenderTaskId());
   DALI_TEST_CHECK(renderTask2.GetRenderTaskId() != renderTask3.GetRenderTaskId());
   DALI_TEST_CHECK(renderTask3.GetRenderTaskId() != renderTask1.GetRenderTaskId());
 
   END_TEST;
 }
+
+int UtcDaliRenderTaskDestructWorkerThreadN(void)
+{
+  TestApplication application;
+  tet_infoline("UtcDaliRenderTaskDestructWorkerThreadN Test, for line coverage");
+
+  try
+  {
+    class TestThread : public Thread
+    {
+    public:
+      virtual void Run()
+      {
+        tet_printf("Run TestThread\n");
+        // Destruct at worker thread.
+        mRenderTask.Reset();
+      }
+
+      Dali::RenderTask mRenderTask;
+    };
+    TestThread thread;
+    Stage      stage = Stage::GetCurrent();
+    Vector2    stageSize(stage.GetSize());
+
+    RenderTaskList renderTaskList = stage.GetRenderTaskList();
+
+    RenderTask renderTask = renderTaskList.CreateTask();
+
+    renderTaskList.RemoveTask(renderTask);
+
+    thread.mRenderTask = std::move(renderTask);
+    renderTask.Reset();
+
+    thread.Start();
+
+    thread.Join();
+  }
+  catch(...)
+  {
+  }
+
+  // Always success
+  DALI_TEST_CHECK(true);
+
+  END_TEST;
+}
\ No newline at end of file
index c024dff..50dc71f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -16,6 +16,7 @@
  */
 
 #include <dali-test-suite-utils.h>
+#include <dali/devel-api/threading/thread.h>
 #include <dali/public-api/dali-core.h>
 #include <stdlib.h>
 
@@ -293,3 +294,49 @@ int UtcDaliRenderTaskListGetTaskNegative(void)
   }
   END_TEST;
 }
+
+int UtcDaliRenderTaskListDestructWorkerThreadN(void)
+{
+  TestApplication application;
+  tet_infoline("UtcDaliRenderTaskListDestructWorkerThreadN Test, for line coverage");
+
+  try
+  {
+    class TestThread : public Thread
+    {
+    public:
+      virtual void Run()
+      {
+        tet_printf("Run TestThread\n");
+        // Destruct at worker thread.
+        mRenderTaskList.Reset();
+      }
+
+      Dali::RenderTaskList mRenderTaskList;
+    };
+    TestThread thread;
+
+    Dali::Integration::Scene scene = Dali::Integration::Scene::New(Size(480.0f, 800.0f));
+
+    RenderTaskList renderTaskList = scene.GetRenderTaskList();
+
+    thread.mRenderTaskList = std::move(renderTaskList);
+    renderTaskList.Reset();
+
+    scene.RemoveSceneObject();
+    scene.Discard();
+    scene.Reset();
+
+    thread.Start();
+
+    thread.Join();
+  }
+  catch(...)
+  {
+  }
+
+  // Always success
+  DALI_TEST_CHECK(true);
+
+  END_TEST;
+}
index 0b09348..dba76d2 100644 (file)
@@ -22,6 +22,7 @@
 #include <dali/devel-api/common/capabilities.h>
 #include <dali/devel-api/common/stage.h>
 #include <dali/devel-api/rendering/renderer-devel.h>
+#include <dali/devel-api/threading/thread.h>
 #include <dali/integration-api/debug.h>
 #include <dali/integration-api/render-task-list-integ.h>
 #include <dali/public-api/dali-core.h>
@@ -4937,11 +4938,6 @@ int UtcDaliRendererUniformBlocks02(void)
   END_TEST;
 }
 
-int AlignSize(int size, int align)
-{
-  return (size % align == 0) ? size : ((size / align) + 1) * align;
-}
-
 int UtcDaliRendererUniformBlocks03(void)
 {
   setenv("LOG_UNIFORM_BUFFER", "5f", 1); // Turns on buffer logging
@@ -5210,4 +5206,45 @@ int UtcDaliRendererUniformArrayOverflow(void)
   // if r is 0.0f then test fails as the array stomped on the uniform's memory.
   DALI_TEST_EQUALS((uniformColor.r != 0.0f), true, TEST_LOCATION);
   END_TEST;
-}
\ No newline at end of file
+}
+
+int UtcDaliRendererDestructWorkerThreadN(void)
+{
+  TestApplication application;
+  tet_infoline("UtcDaliRendererDestructWorkerThreadN Test, for line coverage");
+
+  try
+  {
+    class TestThread : public Thread
+    {
+    public:
+      virtual void Run()
+      {
+        tet_printf("Run TestThread\n");
+        // Destruct at worker thread.
+        mRenderer.Reset();
+      }
+
+      Dali::Renderer mRenderer;
+    };
+    TestThread thread;
+
+    Dali::Geometry geometry = CreateQuadGeometry();
+    Dali::Shader   shader   = Dali::Shader::New("vertexSrc", "fragmentSrc");
+    Dali::Renderer renderer = Dali::Renderer::New(geometry, shader);
+    thread.mRenderer        = std::move(renderer);
+    renderer.Reset();
+
+    thread.Start();
+
+    thread.Join();
+  }
+  catch(...)
+  {
+  }
+
+  // Always success
+  DALI_TEST_CHECK(true);
+
+  END_TEST;
+}
index ae14fd7..273b79b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -16,6 +16,7 @@
  */
 
 // EXTERNAL INCLUDES
+#include <dali/devel-api/threading/thread.h>
 #include <dali/public-api/dali-core.h>
 #include <string.h>
 #include <unistd.h>
@@ -558,3 +559,42 @@ int UtcDaliSamplerSetFilterModeNegative(void)
   }
   END_TEST;
 }
+
+int UtcDaliSamplerDestructWorkerThreadN(void)
+{
+  TestApplication application;
+  tet_infoline("UtcDaliSamplerDestructWorkerThreadN Test, for line coverage");
+
+  try
+  {
+    class TestThread : public Thread
+    {
+    public:
+      virtual void Run()
+      {
+        tet_printf("Run TestThread\n");
+        // Destruct at worker thread.
+        mSampler.Reset();
+      }
+
+      Dali::Sampler mSampler;
+    };
+    TestThread thread;
+
+    Dali::Sampler sampler = Dali::Sampler::New();
+    thread.mSampler       = std::move(sampler);
+    sampler.Reset();
+
+    thread.Start();
+
+    thread.Join();
+  }
+  catch(...)
+  {
+  }
+
+  // Always success
+  DALI_TEST_CHECK(true);
+
+  END_TEST;
+}
index 367d617..a055704 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <dali-test-suite-utils.h>
 #include <dali/devel-api/common/stage.h>
+#include <dali/devel-api/threading/thread.h>
 #include <dali/integration-api/events/key-event-integ.h>
 #include <dali/integration-api/events/touch-event-integ.h>
 #include <dali/integration-api/events/wheel-event-integ.h>
@@ -3090,3 +3091,58 @@ int UtcDaliSceneGetNativeId(void)
   DALI_TEST_EQUALS(nativeId, 1, TEST_LOCATION);
   END_TEST;
 }
+
+int UtcDaliSceneDestructWorkerThreadN(void)
+{
+  TestApplication application;
+  tet_infoline("UtcDaliSceneDestructWorkerThreadN Test, for line coverage");
+
+  try
+  {
+    class TestThread : public Thread
+    {
+    public:
+      virtual void Run()
+      {
+        tet_printf("Run TestThread\n");
+        // RemoveSceneObject, Discard and Destruct at worker thread.
+        mScene.RemoveSceneObject();
+        mScene.Discard();
+
+        mScene.Reset();
+      }
+
+      Dali::Integration::Scene mScene;
+    };
+    TestThread thread;
+
+    Dali::Integration::Scene scene = Dali::Integration::Scene::New(Size(480.0f, 800.0f));
+
+    // Unparent of DefaultCamera might throw exception. and exception at destructor will make abort.
+    // To avoid it, we should remove all children of root layer.
+    while(scene.GetRootLayer().GetChildCount() > 0)
+    {
+      auto child = scene.GetRootLayer().GetChildAt(0);
+      scene.GetRootLayer().Remove(child);
+    }
+
+    // To make ensure the last reference is in thread, call Discard first.
+    scene.Discard();
+
+    thread.mScene = std::move(scene);
+    scene.Reset();
+
+    thread.Start();
+
+    thread.Join();
+  }
+  catch(...)
+  {
+  }
+
+  // Always success
+  DALI_TEST_CHECK(true);
+
+  END_TEST;
+}
+>>>>>>> 42f1aca96... Print log if worker thread destruction occured for UI items.
index cf23d79..f419d74 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #include <dali-test-suite-utils.h>
+#include <dali/devel-api/threading/thread.h>
 #include <dali/public-api/dali-core.h>
 #include <mesh-builder.h>
 #include <stdlib.h>
@@ -730,4 +731,43 @@ int UtcDaliShaderWrongData(void)
   DALI_TEST_CHECK(arrayCount == 0u);
 
   END_TEST;
-}
\ No newline at end of file
+}
+
+int UtcDaliShaderDestructWorkerThreadN(void)
+{
+  TestApplication application;
+  tet_infoline("UtcDaliShaderDestructWorkerThreadN Test, for line coverage");
+
+  try
+  {
+    class TestThread : public Thread
+    {
+    public:
+      virtual void Run()
+      {
+        tet_printf("Run TestThread\n");
+        // Destruct at worker thread.
+        mShader.Reset();
+      }
+
+      Dali::Shader mShader;
+    };
+    TestThread thread;
+
+    Dali::Shader shader = Dali::Shader::New("", "");
+    thread.mShader      = std::move(shader);
+    shader.Reset();
+
+    thread.Start();
+
+    thread.Join();
+  }
+  catch(...)
+  {
+  }
+
+  // Always success
+  DALI_TEST_CHECK(true);
+
+  END_TEST;
+}
index 8bbbdaa..655136e 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <dali-test-suite-utils.h>
 #include <dali/devel-api/rendering/texture-devel.h>
+#include <dali/devel-api/threading/thread.h>
 #include <dali/integration-api/pixel-data-integ.h>
 #include <dali/integration-api/texture-integ.h>
 #include <dali/public-api/dali-core.h>
@@ -1726,3 +1727,55 @@ int utcDaliTexturePartialUpdate02(void)
 
   END_TEST;
 }
+
+int UtcDaliTextureDestructWorkerThreadN(void)
+{
+  TestApplication application;
+  tet_infoline("UtcDaliTextureDestructWorkerThreadN Test, for line coverage");
+
+  try
+  {
+    class TestThread : public Thread
+    {
+    public:
+      virtual void Run()
+      {
+        tet_printf("Run TestThread\n");
+        // Upload at worker thread
+        uint8_t*        rawBuffer = new uint8_t[4];
+        Dali::PixelData pixelData = Dali::PixelData::New(rawBuffer, 4, 1, 1, Pixel::RGBA8888, Dali::PixelData::DELETE_ARRAY);
+
+        // Use try-catch to avoid memory leak false alarm
+        try
+        {
+          // Upload, GenerateMipmaps, and Destruct at worker thread.
+          mTexture.Upload(pixelData);
+          mTexture.GenerateMipmaps();
+          mTexture.Reset();
+        }
+        catch(...)
+        {
+        }
+      }
+
+      Dali::Texture mTexture;
+    };
+    TestThread thread;
+
+    Dali::Texture texture = Dali::Texture::New(Dali::TextureType::TEXTURE_2D, Pixel::RGBA8888, 100, 100);
+    thread.mTexture       = std::move(texture);
+    texture.Reset();
+
+    thread.Start();
+
+    thread.Join();
+  }
+  catch(...)
+  {
+  }
+
+  // Always success
+  DALI_TEST_CHECK(true);
+
+  END_TEST;
+}
index a06ae42..07ef1f7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -16,6 +16,7 @@
  */
 
 // EXTERNAL INCLUDES
+#include <dali/devel-api/threading/thread.h>
 #include <dali/public-api/dali-core.h>
 
 // INTERNAL INCLUDES
@@ -653,3 +654,42 @@ int UtcDaliTextureSetMultipleTextures(void)
 
   END_TEST;
 }
+
+int UtcDaliTextureSetDestructWorkerThreadN(void)
+{
+  TestApplication application;
+  tet_infoline("UtcDaliTextureSetDestructWorkerThreadN Test, for line coverage");
+
+  try
+  {
+    class TestThread : public Thread
+    {
+    public:
+      virtual void Run()
+      {
+        tet_printf("Run TestThread\n");
+        // Destruct at worker thread.
+        mTextureSet.Reset();
+      }
+
+      Dali::TextureSet mTextureSet;
+    };
+    TestThread thread;
+
+    Dali::TextureSet textureSet = Dali::TextureSet::New();
+    thread.mTextureSet          = std::move(textureSet);
+    textureSet.Reset();
+
+    thread.Start();
+
+    thread.Join();
+  }
+  catch(...)
+  {
+  }
+
+  // Always success
+  DALI_TEST_CHECK(true);
+
+  END_TEST;
+}
index d407b36..d72fa2b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -16,6 +16,7 @@
  */
 
 #include <dali-test-suite-utils.h>
+#include <dali/devel-api/threading/thread.h>
 #include <dali/public-api/dali-core.h>
 #include <chrono>
 using namespace std::chrono_literals;
@@ -723,3 +724,44 @@ int UtcDaliSetAndRemoveVertexBufferUpdateCallback(void)
 
   END_TEST;
 }
+
+int UtcDaliVertexBufferDestructWorkerThreadN(void)
+{
+  TestApplication application;
+  tet_infoline("UtcDaliAnimationDestructWorkerThreadN Test, for line coverage");
+
+  try
+  {
+    class TestThread : public Thread
+    {
+    public:
+      virtual void Run()
+      {
+        tet_printf("Run TestThread\n");
+        // Destruct at worker thread.
+        mVertexBuffer.Reset();
+      }
+
+      Dali::VertexBuffer mVertexBuffer;
+    };
+    TestThread thread;
+
+    Dali::VertexBuffer vertexBuffer = VertexBuffer::New(Property::Map() = {
+                                                          {"aPosition", Property::Type::VECTOR2},
+                                                          {"aTexCoord", Property::Type::VECTOR2}});
+    thread.mVertexBuffer            = std::move(vertexBuffer);
+    vertexBuffer.Reset();
+
+    thread.Start();
+
+    thread.Join();
+  }
+  catch(...)
+  {
+  }
+
+  // Always success
+  DALI_TEST_CHECK(true);
+
+  END_TEST;
+}
index 92ac85c..a327783 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -1152,12 +1152,17 @@ void Actor::Initialize()
 
 Actor::~Actor()
 {
+  if(DALI_UNLIKELY(!Dali::Stage::IsCoreThread()))
+  {
+    DALI_LOG_ERROR("~Actor[%p] called from non-UI thread! something unknown issue will be happened!\n", this);
+  }
+
   // Remove mParent pointers from children even if we're destroying core,
   // to guard against GetParent() & Unparent() calls from CustomActor destructors.
   UnparentChildren();
 
   // Guard to allow handle destruction after Core has been destroyed
-  if(EventThreadServices::IsCoreRunning())
+  if(DALI_LIKELY(EventThreadServices::IsCoreRunning()))
   {
     if(mRenderers)
     {
@@ -1346,7 +1351,7 @@ void Actor::NotifyStageDisconnection(bool notify)
   // Actors can be added (in a callback), before the off-stage state is reported.
   // Also if the actor was added & removed before mOnSceneSignalled was set, then we don't notify here.
   // only do this step if there is a stage, i.e. Core is not being shut down
-  if(EventThreadServices::IsCoreRunning() && !OnScene() && mOnSceneSignalled)
+  if(DALI_LIKELY(EventThreadServices::IsCoreRunning()) && !OnScene() && mOnSceneSignalled)
   {
     if(notify)
     {
index 6e02cb0..e4a671b 100644 (file)
@@ -145,7 +145,7 @@ Layer::~Layer()
   if(mIsRoot)
   {
     // Guard to allow handle destruction after Core has been destroyed
-    if(EventThreadServices::IsCoreRunning())
+    if(DALI_LIKELY(EventThreadServices::IsCoreRunning()))
     {
       UninstallRootMessage(GetEventThreadServices().GetUpdateManager(), &GetSceneGraphLayer());
 
index 1adfcf3..908126e 100644 (file)
@@ -261,6 +261,11 @@ void Animation::Initialize()
 
 Animation::~Animation()
 {
+  if(DALI_UNLIKELY(!Dali::Stage::IsCoreThread()))
+  {
+    DALI_LOG_ERROR("~Animation[%p] called from non-UI thread! something unknown issue will be happened!\n", this);
+  }
+
   // Guard to allow handle destruction after Core has been destroyed
   if(Stage::IsInstalled())
   {
index d41825d..d27a5ef 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -81,6 +81,11 @@ ConstraintBase* ConstraintBase::Clone(Object& object)
 
 ConstraintBase::~ConstraintBase()
 {
+  if(DALI_UNLIKELY(!Dali::Stage::IsCoreThread()))
+  {
+    DALI_LOG_ERROR("~ConstraintBase[%p] called from non-UI thread! something unknown issue will be happened!\n", this);
+  }
+
   StopObservation();
 
   RemoveInternal();
@@ -108,7 +113,7 @@ void ConstraintBase::Apply(bool isPreConstraint)
 {
   if(mTargetObject && !mApplied && !mSourceDestroyed)
   {
-    mApplied = true;
+    mApplied         = true;
     mIsPreConstraint = isPreConstraint;
     ConnectConstraint(mIsPreConstraint);
 
index 5200ac0..3bec4cf 100644 (file)
@@ -977,6 +977,13 @@ Object::Object(const SceneGraph::PropertyOwner* sceneObject)
 
 Object::~Object()
 {
+  if(DALI_UNLIKELY(!Dali::Stage::IsCoreThread()))
+  {
+    if(nullptr != mUpdateObject)
+    {
+      DALI_LOG_ERROR("~Object[%p] called from non-UI thread! something unknown issue will be happened!\n", this);
+    }
+  }
   // Notification for observers
   for(auto&& item : mObservers)
   {
index 25655de..25cd4e6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -68,6 +68,11 @@ Scene::Scene()
 
 Scene::~Scene()
 {
+  if(DALI_UNLIKELY(!Dali::Stage::IsCoreThread()))
+  {
+    DALI_LOG_ERROR("~Scene[%p] called from non-UI thread! something unknown issue will be happened!\n", this);
+  }
+
   if(mDefaultCamera)
   {
     // its enough to release the handle so the object is released
@@ -240,21 +245,29 @@ void Scene::SurfaceReplaced()
 
 void Scene::RemoveSceneObject()
 {
-  if(EventThreadServices::IsCoreRunning() && mSceneObject)
+  if(DALI_LIKELY(EventThreadServices::IsCoreRunning() && mSceneObject))
   {
     ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal();
     RemoveSceneMessage(tls->GetUpdateManager(), *mSceneObject);
     mSceneObject = nullptr;
   }
+  else if(DALI_UNLIKELY(!Dali::Stage::IsCoreThread()))
+  {
+    DALI_LOG_ERROR("Scene[%p] called RemoveSceneObject API from non-UI thread!\n", this);
+  }
 }
 
 void Scene::Discard()
 {
-  if(EventThreadServices::IsCoreRunning())
+  if(DALI_LIKELY(EventThreadServices::IsCoreRunning()))
   {
     ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal();
     tls->RemoveScene(this);
   }
+  else if(DALI_UNLIKELY(!Dali::Stage::IsCoreThread()))
+  {
+    DALI_LOG_ERROR("Scene[%p] called Discard API from non-UI thread!\n", this);
+  }
 }
 
 void Scene::RequestRebuildDepthTree()
index fc6f510..2d48070 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -47,6 +47,11 @@ GestureDetector::GestureDetector(GestureType::Value type, const SceneGraph::Prop
 
 GestureDetector::~GestureDetector()
 {
+  if(DALI_UNLIKELY(!Dali::Stage::IsCoreThread()))
+  {
+    DALI_LOG_ERROR("~GestureDetector[%p] called from non-UI thread! something unknown issue will be happened!\n", this);
+  }
+
   if(!mPendingAttachActors.empty())
   {
     for(GestureDetectorActorContainer::iterator iter = mPendingAttachActors.begin(), endIter = mPendingAttachActors.end(); iter != endIter; ++iter)
@@ -265,7 +270,7 @@ Dali::Actor GestureDetector::GetAttachedActor(size_t index) const
 
 bool GestureDetector::HandleEvent(Dali::Actor& actor, Dali::TouchEvent& touch)
 {
-  bool ret = false;
+  bool                   ret = false;
   Dali::Internal::Actor& actorImpl(GetImplementation(actor));
   if(touch.GetPointCount() > 0 && actorImpl.OnScene())
   {
@@ -279,9 +284,9 @@ bool GestureDetector::HandleEvent(Dali::Actor& actor, Dali::TouchEvent& touch)
     }
 
     Integration::TouchEvent touchEvent(touch.GetTime());
-    for(std::size_t i = 0; i< touch.GetPointCount(); i++)
+    for(std::size_t i = 0; i < touch.GetPointCount(); i++)
     {
-      Integration::Point      point;
+      Integration::Point point;
       point.SetState(touch.GetState(i));
       point.SetDeviceId(touch.GetDeviceId(i));
       point.SetScreenPosition(touch.GetScreenPosition(i));
@@ -296,7 +301,6 @@ bool GestureDetector::HandleEvent(Dali::Actor& actor, Dali::TouchEvent& touch)
       touchEvent.points.push_back(point);
     }
 
-
     Dali::Internal::TouchEvent& touchEventImpl(GetImplementation(touch));
     mFeededActor.SetActor(&actorImpl);
     mRenderTask = &GetImplementation(touchEventImpl.GetRenderTaskPtr());
index 4ac98f3..acb8b7a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -495,8 +495,8 @@ bool RenderTask::TranslateCoordinates(Vector2& screenCoords) const
       return false;
     }
 
-    CameraActor*     localCamera       = GetCameraActor();
-    StagePtr         stage             = Stage::GetCurrent();
+    CameraActor* localCamera = GetCameraActor();
+    StagePtr     stage       = Stage::GetCurrent();
     if(stage)
     {
       Vector2      size(stage->GetSize());
@@ -972,6 +972,11 @@ RenderTask::RenderTask(const SceneGraph::RenderTask* sceneObject, RenderTaskList
 
 RenderTask::~RenderTask()
 {
+  if(DALI_UNLIKELY(!Dali::Stage::IsCoreThread()))
+  {
+    DALI_LOG_ERROR("~RenderTask[%p] called from non-UI thread! something unknown issue will be happened!\n", this);
+  }
+
   DALI_LOG_INFO(gLogRender, Debug::General, "RenderTask::~RenderTask(this:%p)\n", this);
   // scene object deletion is handled by our parent
   // scene object handles observation of source and camera
index 34912a0..c130e37 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -176,11 +176,10 @@ void RenderTaskList::SortTasks()
     return;
   }
 
-  std::stable_sort(mTasks.begin(), mTasks.end(), [](RenderTaskPtr first, RenderTaskPtr second) -> bool
-                   { return first->GetOrderIndex() < second->GetOrderIndex(); });
+  std::stable_sort(mTasks.begin(), mTasks.end(), [](RenderTaskPtr first, RenderTaskPtr second) -> bool { return first->GetOrderIndex() < second->GetOrderIndex(); });
 
   OwnerPointer<std::vector<const SceneGraph::RenderTask*>> sortedTasks(new std::vector<const SceneGraph::RenderTask*>());
-  for(auto && task : mTasks)
+  for(auto&& task : mTasks)
   {
     sortedTasks->push_back(task->GetRenderTaskSceneObject());
   }
@@ -197,7 +196,12 @@ RenderTaskList::RenderTaskList()
 
 RenderTaskList::~RenderTaskList()
 {
-  if(EventThreadServices::IsCoreRunning() && mSceneObject)
+  if(DALI_UNLIKELY(!Dali::Stage::IsCoreThread()))
+  {
+    DALI_LOG_ERROR("~RenderTaskList[%p] called from non-UI thread! something unknown issue will be happened!\n", this);
+  }
+
+  if(DALI_LIKELY(EventThreadServices::IsCoreRunning() && mSceneObject))
   {
     // Remove the render task list using a message to the update manager
     RemoveRenderTaskListMessage(mEventThreadServices.GetUpdateManager(), *mSceneObject);
index eb01d3c..4b37a4a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -135,7 +135,12 @@ void FrameBuffer::SetSize(uint32_t width, uint32_t height)
 
 FrameBuffer::~FrameBuffer()
 {
-  if(EventThreadServices::IsCoreRunning() && mRenderObject)
+  if(DALI_UNLIKELY(!Dali::Stage::IsCoreThread()))
+  {
+    DALI_LOG_ERROR("~FrameBuffer[%p] called from non-UI thread! something unknown issue will be happened!\n", this);
+  }
+
+  if(DALI_LIKELY(EventThreadServices::IsCoreRunning() && mRenderObject))
   {
     RemoveFrameBuffer(mEventThreadServices.GetUpdateManager(), *mRenderObject);
   }
index 3ec6362..1b965c8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -114,7 +114,12 @@ void Geometry::Initialize()
 
 Geometry::~Geometry()
 {
-  if(EventThreadServices::IsCoreRunning() && mRenderObject)
+  if(DALI_UNLIKELY(!Dali::Stage::IsCoreThread()))
+  {
+    DALI_LOG_ERROR("~Geometry[%p] called from non-UI thread! something unknown issue will be happened!\n", this);
+  }
+
+  if(DALI_LIKELY(EventThreadServices::IsCoreRunning() && mRenderObject))
   {
     RemoveGeometry(mEventThreadServices.GetUpdateManager(), *mRenderObject);
   }
index a34ad18..0132367 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -817,7 +817,12 @@ Renderer::Renderer(const SceneGraph::Renderer* sceneObject)
 
 Renderer::~Renderer()
 {
-  if(EventThreadServices::IsCoreRunning())
+  if(DALI_UNLIKELY(!Dali::Stage::IsCoreThread()))
+  {
+    DALI_LOG_ERROR("~Renderer[%p] called from non-UI thread! something unknown issue will be happened!\n", this);
+  }
+
+  if(DALI_LIKELY(EventThreadServices::IsCoreRunning()))
   {
     EventThreadServices&       eventThreadServices = GetEventThreadServices();
     SceneGraph::UpdateManager& updateManager       = eventThreadServices.GetUpdateManager();
index a1960ee..b3ed0a3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -72,7 +72,12 @@ void Sampler::Initialize()
 
 Sampler::~Sampler()
 {
-  if(EventThreadServices::IsCoreRunning() && mRenderObject)
+  if(DALI_UNLIKELY(!Dali::Stage::IsCoreThread()))
+  {
+    DALI_LOG_ERROR("~Sampler[%p] called from non-UI thread! something unknown issue will be happened!\n", this);
+  }
+
+  if(DALI_LIKELY(EventThreadServices::IsCoreRunning() && mRenderObject))
   {
     SceneGraph::UpdateManager& updateManager = mEventThreadServices.GetUpdateManager();
     RemoveSamplerMessage(updateManager, *mRenderObject);
index de3c95e..0e3022a 100644 (file)
@@ -318,7 +318,12 @@ void Shader::SetShaderProperty(const Dali::Property::Value& shaderMap)
 
 Shader::~Shader()
 {
-  if(EventThreadServices::IsCoreRunning())
+  if(DALI_UNLIKELY(!Dali::Stage::IsCoreThread()))
+  {
+    DALI_LOG_ERROR("~Shader[%p] called from non-UI thread! something unknown issue will be happened!\n", this);
+  }
+
+  if(DALI_LIKELY(EventThreadServices::IsCoreRunning()))
   {
     EventThreadServices&       eventThreadServices = GetEventThreadServices();
     SceneGraph::UpdateManager& updateManager       = eventThreadServices.GetUpdateManager();
index 7488fc5..15a861a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -93,7 +93,7 @@ Texture::Texture(TextureType::Type type, uint32_t resourceId)
 
 void Texture::Initialize()
 {
-  if(EventThreadServices::IsCoreRunning())
+  if(DALI_LIKELY(EventThreadServices::IsCoreRunning()))
   {
     if(mNativeImage)
     {
@@ -117,7 +117,12 @@ void Texture::Initialize()
 
 Texture::~Texture()
 {
-  if(EventThreadServices::IsCoreRunning() && mTextureKey)
+  if(DALI_UNLIKELY(!Dali::Stage::IsCoreThread()))
+  {
+    DALI_LOG_ERROR("~Texture[%p] called from non-UI thread! something unknown issue will be happened!\n", this);
+  }
+
+  if(DALI_LIKELY(EventThreadServices::IsCoreRunning() && mTextureKey))
   {
     RemoveTextureMessage(mEventThreadServices.GetUpdateManager(), mTextureKey);
   }
@@ -170,7 +175,7 @@ bool Texture::UploadSubPixelData(PixelDataPtr pixelData,
                      "Parameter value out of range");
 
   bool result(false);
-  if(EventThreadServices::IsCoreRunning() && mTextureKey)
+  if(DALI_LIKELY(EventThreadServices::IsCoreRunning() && mTextureKey))
   {
     if(mNativeImage)
     {
@@ -246,16 +251,24 @@ bool Texture::UploadSubPixelData(PixelDataPtr pixelData,
       }
     }
   }
+  else
+  {
+    DALI_LOG_ERROR("Texture[%p] called Upload API from non-UI thread!\n", this);
+  }
 
   return result;
 }
 
 void Texture::GenerateMipmaps()
 {
-  if(EventThreadServices::IsCoreRunning() && mTextureKey)
+  if(DALI_LIKELY(EventThreadServices::IsCoreRunning() && mTextureKey))
   {
     GenerateMipmapsMessage(mEventThreadServices.GetUpdateManager(), mTextureKey);
   }
+  else
+  {
+    DALI_LOG_ERROR("Texture[%p] called GenerateMipmaps API from non-UI thread!\n", this);
+  }
 }
 
 uint32_t Texture::GetWidth() const
@@ -286,7 +299,7 @@ Dali::TextureType::Type Texture::GetTextureType() const
 void Texture::SetSize(const ImageDimensions& size)
 {
   mSize = size;
-  if(EventThreadServices::IsCoreRunning() && mTextureKey)
+  if(DALI_LIKELY(EventThreadServices::IsCoreRunning() && mTextureKey))
   {
     SetTextureSizeMessage(mEventThreadServices.GetUpdateManager(), mTextureKey, mSize);
   }
@@ -295,7 +308,7 @@ void Texture::SetSize(const ImageDimensions& size)
 void Texture::SetPixelFormat(Pixel::Format format)
 {
   mFormat = format;
-  if(EventThreadServices::IsCoreRunning() && mTextureKey)
+  if(DALI_LIKELY(EventThreadServices::IsCoreRunning() && mTextureKey))
   {
     SetTextureFormatMessage(mEventThreadServices.GetUpdateManager(), mTextureKey, mFormat);
   }
index 61db3dc..fc99607 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -187,7 +187,12 @@ void TextureSet::Initialize()
 
 TextureSet::~TextureSet()
 {
-  if(EventThreadServices::IsCoreRunning())
+  if(DALI_UNLIKELY(!Dali::Stage::IsCoreThread()))
+  {
+    DALI_LOG_ERROR("~TextureSet[%p] called from non-UI thread! something unknown issue will be happened!\n", this);
+  }
+
+  if(DALI_LIKELY(EventThreadServices::IsCoreRunning()))
   {
     SceneGraph::UpdateManager& updateManager = mEventThreadServices.GetUpdateManager();
     RemoveTextureSetMessage(updateManager, *mSceneObject);
index 73e67a5..28bcc79 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -215,7 +215,12 @@ const Render::VertexBuffer* VertexBuffer::GetRenderObject() const
 
 VertexBuffer::~VertexBuffer()
 {
-  if(EventThreadServices::IsCoreRunning() && mRenderObject)
+  if(DALI_UNLIKELY(!Dali::Stage::IsCoreThread()))
+  {
+    DALI_LOG_ERROR("~VertexBuffer[%p] called from non-UI thread! something unknown issue will be happened!\n", this);
+  }
+
+  if(DALI_LIKELY(EventThreadServices::IsCoreRunning() && mRenderObject))
   {
     SceneGraph::RemoveVertexBuffer(mEventThreadServices.GetUpdateManager(), *mRenderObject);
   }