Check SceneHolder validation if we call GetWindowIdFromActor 62/314962/3
authorEunki, Hong <eunkiki.hong@samsung.com>
Wed, 24 Jul 2024 01:22:09 +0000 (10:22 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Wed, 24 Jul 2024 06:13:55 +0000 (15:13 +0900)
Since SceneHolder destructor doesn't change child's SceneOn state directly,
It might be possible that SceneHolder is destroyed but Scene is alive.

To avoid this case, let we check the SceneHolder validation one more time.

Change-Id: If442cfe725198d13b52a4a470134a83d51573326
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.cpp

index 330c4d9..b706cee 100644 (file)
@@ -311,13 +311,17 @@ int GetWindowIdFromActor(Dali::Actor actor)
 
   if(actor.GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE))
   {
-    Any nativeWindowHandle = Dali::Integration::SceneHolder::Get(actor).GetNativeHandle();
+    auto sceneHolder = Dali::Integration::SceneHolder::Get(actor);
+    if(DALI_LIKELY(sceneHolder))
+    {
+      Any nativeWindowHandle = sceneHolder.GetNativeHandle();
 
 #ifdef ECORE_WAYLAND2
-    windowId = ecore_wl2_window_id_get(AnyCast<Ecore_Wl2_Window*>(nativeWindowHandle));
+      windowId = ecore_wl2_window_id_get(AnyCast<Ecore_Wl2_Window*>(nativeWindowHandle));
 #else
-    windowId = ecore_wl_window_id_get(AnyCast<Ecore_Wl_Window*>(nativeWindowHandle));
+      windowId = ecore_wl_window_id_get(AnyCast<Ecore_Wl_Window*>(nativeWindowHandle));
 #endif
+    }
   }
 
   return windowId;
@@ -1224,7 +1228,7 @@ bool InputMethodContextEcoreWl::SetInputPanelPositionAlign(int x, int y, Dali::I
   if(mIMFContext)
   {
     Ecore_IMF_Input_Panel_Align inputPanelAlign = ECORE_IMF_INPUT_PANEL_ALIGN_TOP_LEFT;
-    switch (align)
+    switch(align)
     {
       case Dali::InputMethodContext::InputPanelAlign::TOP_LEFT:
       {