[Tizen] Print log if worker thread destruction occured for UI items. 15/314115/1 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 f08e19db1b9b1f61087463d16283046835dff78a..8597d1857ab1cb399a96015cf428770a0560283f 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 6adfc799d9b0541913402f718809bd27e9e266f1..137c5d0fb3f1fac1699709823ffe8173d148747f 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 dfb0db15a5fc42341f710e2087b906e9fc7c14f3..e0725adf24a0ec7bb3b5b3b3305ffb8a15c831db 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 bb1205dcec9d5d43dc437dfd95c8584422924c99..437ea1b78adaf0342b949fca690389c8b4d19975 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 e12bbdbe57d0c7eefc1516b6927d3a0743077d73..c064f8de804992e6d83e9ca008ac15ccd6dd1d3a 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 cf7bd9759ce0bfb01fb25a68c878cd84872bc1fe..087c6eaeb38aed31dd10f4eb56779f40c3fbe76c 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 c024dffb4e4c901ca049299cb08635ebc02dfd51..50dc71fd903458f99e5091bb02fde4c120262ebc 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 0b0934850ee3e3ceafa57fd482069e1d2c814b38..dba76d2f432f2dd27adb6135fe3b6177d0a9e008 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 ae14fd7e2f4926e321ac2268ed84ca839c8f91ef..273b79ba3aec27143f86f5590495ceb2c11acd4d 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 367d6175f691afb8fa9fb2aa47afe703e88f69b1..a055704e244d3fecf550c05b83c321247756f43e 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 cf23d79adac1e76c59200c642600a9ed6a15e951..f419d749f165c47f394967054a5530545d0e9d1d 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 8bbbdaa6d426dff06ec5348fd9298cd29e5d8a5a..655136eba920bb7f91bc8bc997c4797189560ff9 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 a06ae426acd74fa207179bbd683cb229fbb14457..07ef1f746b0d40dfbe0ff0990bd9d7bdea6511f4 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 d407b36b8a79cb646257666ddce65959da1d4252..d72fa2babc362c13ab4ea37bf0a83dbb549bcf4f 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 92ac85c59af6e10d7bfa1d6b520cb6f00e6ce4df..a327783c55053985d87c46e3edb0d8592e677ebe 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 6e02cb0817118d94f38ca4228315dfeefb1291e3..e4a671bf03f3677c5b52f7e8ba51f845a99f8c60 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 1adfcf3b3992d4f88b0ed996dc222d34cae6e351..908126e562a211767d694263e45f60a89b37274b 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 d41825d2fb16487062ebca7176f6a0ee7608afe1..d27a5efb9ae117582148fb85d8278c9592f55705 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 5200ac042f330d578d00d9c7324d025910391711..3bec4cfcb098070edf011a9c599808c5c2020fcd 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 25655dee509004b003f845b16ac7ff2b24a2122f..25cd4e6347aad463587fd7b5d4de8409ca2ac7c7 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 fc6f510a1e3b343f1f0c4b79a13bc6c333cdd6eb..2d4807010513180466bb6c29f499862dd0de02c8 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 4ac98f3fbaa5f7991a87a3e813143cedbb11b870..acb8b7a3d9f40bae4de0f99d64e060a77872afcb 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 34912a08f86c7744419b02e84af5bfef3a9f710e..c130e373fe26a3e2e3b504de66519ba96652a780 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 eb01d3c3735b9d83158cca490b8514b5d0acddfb..4b37a4a8bc9380e4af5e95aa4f1b3320469b11c9 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 3ec63622ecb8ee5c817dd09ec5b80d8260971005..1b965c85e419b86a32949f68c9a5cebcc79dad0f 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 a34ad18a0183687f8fca33314f97dc98417b6361..0132367c4999978bcc3c5a6e10fef7a64b8850b4 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 a1960ee800418c8881f2b2fbfdf51deb2b9918db..b3ed0a3c66f714e3c437d87aa47f946e27af33e4 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 de3c95eef94cdc313951a648bcd66f5f1ccbaf6c..0e3022a04357d75b5d577b074956a34e91e9d511 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 7488fc5f6d41cf927d756c6c54c8cb7601218243..15a861ad3b66c91afb78cf524d07f60aebdbaa03 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 61db3dc229816abf8c562b60601584b4ba60467a..fc99607b90648b74e7904527aea508a61c4f99a9 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 73e67a551d9701978e30442248d336a53ddc727f..28bcc798418965b4ea3c93f017fec2ef200f3750 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);
   }