Print log if worker thread destruction occured for UI items. 79/313979/7
authorEunki, Hong <eunkiki.hong@samsung.com>
Wed, 3 Jul 2024 11:24:22 +0000 (20:24 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Thu, 4 Jul 2024 11:30:51 +0000 (20:30 +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 4eb8f54..43facb5 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>
@@ -15021,3 +15022,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 c0b2003..9015692 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>
@@ -748,13 +749,13 @@ int UtcDaliRenderTaskRenderUntil01(void)
     Actor parent = CreateRenderableActor();
     parent.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f));
     parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
-    Actor  child = CreateRenderableActor();
+    Actor child = CreateRenderableActor();
     child.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f));
 
     stage.Add(parent);
     parent.Add(child);
 
-    if (i == 1)
+    if(i == 1)
     {
       secondChild = child;
     }
@@ -793,13 +794,13 @@ int UtcDaliRenderTaskRenderUntil02(void)
     Actor parent = CreateRenderableActor();
     parent.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f));
     parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
-    Actor  child = Actor::New(); // Has no renderer
+    Actor child = Actor::New(); // Has no renderer
     child.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f));
 
     stage.Add(parent);
     parent.Add(child);
 
-    if (i == 1)
+    if(i == 1)
     {
       secondChild = child;
     }
@@ -4468,7 +4469,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)
   {
@@ -4550,19 +4551,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);
@@ -4596,10 +4597,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 9b83276..6de5ee4 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>
@@ -4796,9 +4797,7 @@ int UtcDaliRendererUniformBlocks01(void)
   const int skinningBlockSize = MAX_BONE_COUNT * sizeof(Matrix);
 
   graphics.AddCustomUniformBlock(TestGraphicsReflection::TestUniformBlockInfo{
-    "Skinning Block", 0, 0,
-    skinningBlockSize,
-    {{"uBone", Graphics::UniformClass::UNIFORM, 0, 0, {0}, {1}, MAX_BONE_COUNT, Property::Type::MATRIX}}});
+    "Skinning Block", 0, 0, skinningBlockSize, {{"uBone", Graphics::UniformClass::UNIFORM, 0, 0, {0}, {1}, MAX_BONE_COUNT, Property::Type::MATRIX}}});
 
   const int MAX_MORPH_COUNT{128};
   const int morphBlockSize = MAX_MORPH_COUNT * sizeof(float) + sizeof(float);
@@ -4953,22 +4952,22 @@ int UtcDaliRendererUniformBlocksWithStride(void)
   const uint32_t UNIFORM_BLOCK_ALIGNMENT(512);
   gl.SetUniformBufferOffsetAlignment(UNIFORM_BLOCK_ALIGNMENT);
 
-  const int MAX_BONE_COUNT{300};
+  const int                                    MAX_BONE_COUNT{300};
   TestGraphicsReflection::TestUniformBlockInfo skinningBlock;
   skinningBlock.name          = "SkinningBlock";
   skinningBlock.binding       = 0;
   skinningBlock.descriptorSet = 0;
-  graphics.AddMemberToUniformBlock( skinningBlock, "uBone", Property::Type::MATRIX, MAX_BONE_COUNT, 16 );
+  graphics.AddMemberToUniformBlock(skinningBlock, "uBone", Property::Type::MATRIX, MAX_BONE_COUNT, 16);
   graphics.AddCustomUniformBlock(skinningBlock);
   const int skinningBlockSize = int(skinningBlock.size);
 
-  const int MAX_MORPH_COUNT{128};
+  const int                                    MAX_MORPH_COUNT{128};
   TestGraphicsReflection::TestUniformBlockInfo morphBlock;
   morphBlock.name          = "MorphBlock";
   morphBlock.binding       = 1;
   morphBlock.descriptorSet = 0;
-  graphics.AddMemberToUniformBlock( morphBlock, "uNumberOfBlendShapes", Property::Type::FLOAT, 0, 0 );
-  graphics.AddMemberToUniformBlock( morphBlock, "uBlendShapeWeight", Property::Type::FLOAT, MAX_MORPH_COUNT, 16 );
+  graphics.AddMemberToUniformBlock(morphBlock, "uNumberOfBlendShapes", Property::Type::FLOAT, 0, 0);
+  graphics.AddMemberToUniformBlock(morphBlock, "uBlendShapeWeight", Property::Type::FLOAT, MAX_MORPH_COUNT, 16);
   graphics.AddCustomUniformBlock(morphBlock);
 
   Actor    actor    = CreateActor(application.GetScene().GetRootLayer(), 0, TEST_LOCATION);
@@ -5007,15 +5006,15 @@ int UtcDaliRendererUniformBlocksWithStride(void)
     TestGraphicsBuffer* bufferPtr = FindUniformBuffer(i % 2, graphics);
     DALI_TEST_CHECK(graphics.mAllocatedBuffers.size() == (i == 0 ? 4 : 5));
     DALI_TEST_CHECK(bufferPtr != nullptr);
-    auto offset0 = sizeof(Dali::Matrix) * 299;
-    Matrix* mPtr = reinterpret_cast<Dali::Matrix*>(&bufferPtr->memory[0] + offset0);
+    auto    offset0 = sizeof(Dali::Matrix) * 299;
+    Matrix* mPtr    = reinterpret_cast<Dali::Matrix*>(&bufferPtr->memory[0] + offset0);
     DALI_TEST_EQUALS(*mPtr, n, 0.0001, TEST_LOCATION);
 
-    const auto size = morphBlock.members[1].elementStride;
+    const auto size         = morphBlock.members[1].elementStride;
     const auto memberOffset = morphBlock.members[1].offsets[0];
-    float* wPtr1 = reinterpret_cast<float*>(&bufferPtr->memory[MORPH_BLOCK_OFFSET] + memberOffset + size * 0);
-    float* wPtr2 = reinterpret_cast<float*>(&bufferPtr->memory[MORPH_BLOCK_OFFSET] + memberOffset + size * 55);
-    float* wPtr3 = reinterpret_cast<float*>(&bufferPtr->memory[MORPH_BLOCK_OFFSET] + memberOffset + size * 127);
+    float*     wPtr1        = reinterpret_cast<float*>(&bufferPtr->memory[MORPH_BLOCK_OFFSET] + memberOffset + size * 0);
+    float*     wPtr2        = reinterpret_cast<float*>(&bufferPtr->memory[MORPH_BLOCK_OFFSET] + memberOffset + size * 55);
+    float*     wPtr3        = reinterpret_cast<float*>(&bufferPtr->memory[MORPH_BLOCK_OFFSET] + memberOffset + size * 127);
 
     tet_printf("Test that uBlendShapeWeight[0] is written correctly as %4.2f\n", w1);
     tet_printf("Test that uBlendShapeWeight[55] is written correctly as %4.2f\n", w2);
@@ -5315,4 +5314,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 4249839..94320c5 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>
@@ -3197,4 +3198,58 @@ int UtcDaliSceneRemoveSceneObjectAndRender02(void)
   application.Render(0);
 
   END_TEST;
-}
\ No newline at end of file
+}
+
+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;
+}
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 b46eb90..49e2b69 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.
@@ -1164,12 +1164,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)
     {
@@ -1358,7 +1363,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)
     {
@@ -1523,7 +1528,7 @@ void Actor::LowerBelow(Internal::Actor& target)
 void Actor::SetParent(ActorParent* parent, bool notify)
 {
   bool emitInheritedVisible = false;
-  bool visiblility = true;
+  bool visiblility          = true;
   if(parent)
   {
     DALI_ASSERT_ALWAYS(!mParent && "Actor cannot have 2 parents");
@@ -1753,8 +1758,8 @@ void Actor::SetVisibleInternal(bool visible, SendMessage::Type sendMessage)
       RequestRenderingMessage(GetEventThreadServices().GetUpdateManager());
     }
 
-    Actor* actor = this->GetParent();
-    bool emitInheritedVisible = OnScene();
+    Actor* actor                = this->GetParent();
+    bool   emitInheritedVisible = OnScene();
     while(emitInheritedVisible && actor)
     {
       emitInheritedVisible &= actor->GetProperty(Dali::Actor::Property::VISIBLE).Get<bool>();
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 330ac57..285bddd 100644 (file)
@@ -1019,6 +1019,14 @@ 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);
+    }
+  }
+
   NotifyObservers(*this, mObservers, &Object::Observer::ObjectDestroyed);
 
   // Note : We don't need to restore mObserverNotifying to false as we are in delete the object.
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 1df8c11..c9bce25 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.
@@ -500,8 +500,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());
@@ -658,10 +658,8 @@ uint32_t RenderTask::GetRenderTaskId() const
 void RenderTask::RenderUntil(Actor* stopperActor)
 {
   Actor* target = mSourceActor.GetActor();
-  DALI_ASSERT_ALWAYS((target && stopperActor)
-      && "RenderTask::RenderUntil() has empty actors.");
-  DALI_ASSERT_ALWAYS((target->GetHierarchyDepth() < stopperActor->GetHierarchyDepth())
-      && "RenderTask::RenderUntil() has reversed hierarchy.");
+  DALI_ASSERT_ALWAYS((target && stopperActor) && "RenderTask::RenderUntil() has empty actors.");
+  DALI_ASSERT_ALWAYS((target->GetHierarchyDepth() < stopperActor->GetHierarchyDepth()) && "RenderTask::RenderUntil() has reversed hierarchy.");
 
   Actor* parent = stopperActor;
   while(parent != target && !(parent->IsLayer()))
@@ -998,6 +996,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 fed77c6..9907761 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 76e1e04..fb32ee0 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);
   }