[Tizen] Fix crash when preinitialized app rotated 56/285756/5 accepted/tizen/7.0/unified/20230119.134113
authorEunki, Hong <eunkiki.hong@samsung.com>
Mon, 19 Dec 2022 17:59:23 +0000 (02:59 +0900)
committerWonsik Jung <sidein@samsung.com>
Thu, 19 Jan 2023 05:37:17 +0000 (14:37 +0900)
Change-Id: I12e790436c42dc06bd24db6502807d8557783899
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali/integration-api/adaptor-framework/scene-holder-impl.cpp
dali/internal/window-system/common/window-impl.cpp

index 182c546..93e3c74 100644 (file)
@@ -170,7 +170,10 @@ void SceneHolder::SetSurface(Dali::RenderSurfaceInterface* surface)
 
 void SceneHolder::SurfaceResized(float width, float height)
 {
-  mScene.SurfaceResized(width, height);
+  if(DALI_LIKELY(mScene))
+  {
+    mScene.SurfaceResized(width, height);
+  }
 
   mSurface->SetFullSwapNextFrame();
 
@@ -261,12 +264,18 @@ void SceneHolder::Resume()
 
 void SceneHolder::SurfaceRotated(float width, float height, int32_t windowOrientation, int32_t screenOrientation)
 {
-  mScene.SurfaceRotated(width, height, windowOrientation, screenOrientation);
+  if(DALI_LIKELY(mScene))
+  {
+    mScene.SurfaceRotated(width, height, windowOrientation, screenOrientation);
+  }
 }
 
 void SceneHolder::SetRotationCompletedAcknowledgement()
 {
-  mScene.SetRotationCompletedAcknowledgement();
+  if(DALI_LIKELY(mScene))
+  {
+    mScene.SetRotationCompletedAcknowledgement();
+  }
 }
 
 void SceneHolder::FeedTouchPoint(Dali::Integration::Point& point, int timeStamp)
index 453634d..51c11d0 100644 (file)
@@ -118,7 +118,7 @@ Window::~Window()
     bridge->Emit(accessible, Accessibility::WindowEvent::DESTROY);
   }
 
-  if(mAdaptor)
+  if(DALI_LIKELY(mAdaptor))
   {
     mAdaptor->RemoveWindow(this);
   }
@@ -842,8 +842,11 @@ void Window::OnIconifyChanged(bool iconified)
       mVisibilityChangedSignal.Emit(handle, false);
       Dali::Accessibility::Bridge::GetCurrentBridge()->WindowHidden(handle);
 
-      WindowVisibilityObserver* observer(mAdaptor);
-      observer->OnWindowHidden();
+      if(DALI_LIKELY(mAdaptor))
+      {
+        WindowVisibilityObserver* observer(mAdaptor);
+        observer->OnWindowHidden();
+      }
     }
 
     DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Iconified: visible = %d\n", this, mNativeWindowId, mVisible);
@@ -858,8 +861,11 @@ void Window::OnIconifyChanged(bool iconified)
       mVisibilityChangedSignal.Emit(handle, true);
       Dali::Accessibility::Bridge::GetCurrentBridge()->WindowShown(handle);
 
-      WindowVisibilityObserver* observer(mAdaptor);
-      observer->OnWindowShown();
+      if(DALI_LIKELY(mAdaptor))
+      {
+        WindowVisibilityObserver* observer(mAdaptor);
+        observer->OnWindowShown();
+      }
     }
 
     DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Deiconified: visible = %d\n", this, mNativeWindowId, mVisible);
@@ -895,8 +901,11 @@ void Window::OnOutputTransformed()
 
   SurfaceRotated(static_cast<float>(positionSize.width), static_cast<float>(positionSize.height), mRotationAngle, mWindowBase->GetScreenRotationAngle());
 
-  mAdaptor->SurfaceResizePrepare(mSurface.get(), Adaptor::SurfaceSize(positionSize.width, positionSize.height));
-  mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(positionSize.width, positionSize.height));
+  if(DALI_LIKELY(mAdaptor))
+  {
+    mAdaptor->SurfaceResizePrepare(mSurface.get(), Adaptor::SurfaceSize(positionSize.width, positionSize.height));
+    mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(positionSize.width, positionSize.height));
+  }
 }
 
 void Window::OnDeleteRequest()
@@ -918,7 +927,10 @@ void Window::OnKeyboardRepeatSettingsChanged()
 
 void Window::OnWindowRedrawRequest()
 {
-  mAdaptor->RenderOnce();
+  if(DALI_LIKELY(mAdaptor))
+  {
+    mAdaptor->RenderOnce();
+  }
 }
 
 void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize)
@@ -964,16 +976,25 @@ void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize)
 
     SurfaceResized(static_cast<float>(mWindowWidth), static_cast<float>(mWindowHeight));
 
-    mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
+    if(DALI_LIKELY(mAdaptor))
+    {
+      mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
+    }
 
     DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Resized signal emit [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height);
     mResizeSignal.Emit(handle, newSize);
-    mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize);
+    if(DALI_LIKELY(mAdaptor))
+    {
+      mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize);
+    }
   }
 
   mSurface->SetFullSwapNextFrame();
 
-  Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
+  if(DALI_LIKELY(mScene))
+  {
+    Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
+  }
 }
 
 void Window::OnTouchPoint(Dali::Integration::Point& point, int timeStamp)
@@ -1011,13 +1032,19 @@ void Window::OnRotation(const RotationEvent& rotation)
 
   SurfaceRotated(static_cast<float>(mWindowWidth), static_cast<float>(mWindowHeight), mRotationAngle, mWindowBase->GetScreenRotationAngle());
 
-  mAdaptor->SurfaceResizePrepare(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight));
+  if(DALI_LIKELY(mAdaptor))
+  {
+    mAdaptor->SurfaceResizePrepare(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight));
+  }
 
   Dali::Window handle(this);
   mResizeSignal.Emit(handle, Dali::Window::WindowSize(mWindowWidth, mWindowHeight));
   mOrientationChangedSignal.Emit(handle, GetCurrentOrientation());
 
-  mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight));
+  if(DALI_LIKELY(mAdaptor))
+  {
+    mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight));
+  }
 }
 
 void Window::OnRotationFinished()