[Tizen] Make mScene nullptr when the Actor is disconnected from Scene recursively 09/276309/1 accepted/tizen/6.5/unified/20220629.152550 submit/tizen_6.5/20220616.150849 submit/tizen_6.5/20220628.104132
authorHeeyong Song <heeyong.song@samsung.com>
Mon, 13 Jun 2022 09:27:58 +0000 (18:27 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Tue, 14 Jun 2022 08:30:07 +0000 (17:30 +0900)
Change-Id: I2ef30d3ba471d87baae32d082e91426990d46463

automated-tests/src/dali/utc-Dali-Scene.cpp
dali/internal/event/actors/actor-parent-impl.cpp

index a9a415e..26a7070 100644 (file)
@@ -429,12 +429,26 @@ int UtcDaliSceneGet(void)
 
   Dali::Integration::Scene scene = application.GetScene();
 
-  Actor actor = Actor::New();
-  DALI_TEST_CHECK(Dali::Integration::Scene() == Dali::Integration::Scene::Get(actor));
+  Actor parent = Actor::New();
+  Actor child  = Actor::New();
 
-  scene.Add(actor);
+  parent.Add(child);
+
+  // Should be empty scene
+  DALI_TEST_CHECK(Dali::Integration::Scene() == Dali::Integration::Scene::Get(parent));
+  DALI_TEST_CHECK(Dali::Integration::Scene() == Dali::Integration::Scene::Get(child));
+
+  scene.Add(parent);
 
-  DALI_TEST_CHECK(scene == Dali::Integration::Scene::Get(actor));
+  // Should return the valid scene
+  DALI_TEST_CHECK(scene == Dali::Integration::Scene::Get(parent));
+  DALI_TEST_CHECK(scene == Dali::Integration::Scene::Get(child));
+
+  parent.Unparent();
+
+  // Should be empty scene
+  DALI_TEST_CHECK(Dali::Integration::Scene() == Dali::Integration::Scene::Get(parent));
+  DALI_TEST_CHECK(Dali::Integration::Scene() == Dali::Integration::Scene::Get(child));
 
   END_TEST;
 }
@@ -1737,4 +1751,4 @@ int UtcDaliSceneWheelEventGeneratedSignalP(void)
   DALI_TEST_CHECK(event2.delta == data.receivedWheelEvent.GetDelta());
   DALI_TEST_CHECK(event2.timeStamp == data.receivedWheelEvent.GetTime());
   END_TEST;
-}
\ No newline at end of file
+}
index e26f129..f5311df 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -462,6 +462,7 @@ void ActorParentImpl::RecursiveDisconnectFromScene(ActorContainer& disconnection
 {
   // need to change state first so that internals relying on IsOnScene() inside OnSceneDisconnectionInternal() get the correct value
   mOwner.mIsOnScene = false;
+  mOwner.mScene     = nullptr;
 
   // Recursively disconnect children
   if(mChildren)