From: Eunki, Hong Date: Mon, 19 Dec 2022 17:59:23 +0000 (+0900) Subject: [Tizen] Fix crash when preinitialized app rotated X-Git-Tag: accepted/tizen/7.0/unified/20230119.134113^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=f9b3d71aea0c440d111fff476ad516359351789c [Tizen] Fix crash when preinitialized app rotated Change-Id: I12e790436c42dc06bd24db6502807d8557783899 Signed-off-by: Eunki, Hong --- diff --git a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp index 182c546..93e3c74 100644 --- a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp +++ b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp @@ -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) diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index 453634d..51c11d0 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -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(positionSize.width), static_cast(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(mWindowWidth), static_cast(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(mWindowWidth), static_cast(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()