From b9a39f18e79aff4b5117fd62252e7c87abd14e2c Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Wed, 25 Oct 2023 16:40:43 +0900 Subject: [PATCH] Revert "[Tizen] Ignore adaptor action when adpator is stop" This reverts commit 05f634c9368ac7a0389781caf22874c1c0eb4688. --- .../adaptor-framework/scene-holder-impl.cpp | 57 +++------------------- .../adaptor-framework/scene-holder-impl.h | 16 +++++- 2 files changed, 22 insertions(+), 51 deletions(-) diff --git a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp index 6d281f6..e5703e4 100644 --- a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp +++ b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp @@ -56,24 +56,14 @@ uint32_t SceneHolder::mSceneHolderCounter = 0; class SceneHolder::SceneHolderLifeCycleObserver : public LifeCycleObserver { public: - SceneHolderLifeCycleObserver(Adaptor*& adaptor, bool& adaptorStarted) - : mAdaptor(adaptor), - mAdaptorStarted(adaptorStarted) - { - } + SceneHolderLifeCycleObserver(Adaptor*& adaptor) + : mAdaptor(adaptor){}; private: // Adaptor::LifeCycleObserver interface - void OnStart() override - { - mAdaptorStarted = true; - }; + void OnStart() override{}; void OnPause() override{}; void OnResume() override{}; - void OnStop() override - { - // Mark adaptor as stopped; - mAdaptorStarted = false; - }; + void OnStop() override{}; void OnDestroy() override { mAdaptor = nullptr; @@ -81,17 +71,17 @@ private: // Adaptor::LifeCycleObserver interface private: Adaptor*& mAdaptor; - bool& mAdaptorStarted; }; SceneHolder::SceneHolder() -: mLifeCycleObserver(new SceneHolderLifeCycleObserver(mAdaptor, mAdaptorStarted)), +: mLifeCycleObserver(new SceneHolderLifeCycleObserver(mAdaptor)), mLastTouchEvent(), mLastHoverEvent(), mId(mSceneHolderCounter++), mSurface(nullptr), mAdaptor(nullptr), mDpi(), + mIsBeingDeleted(false), mAdaptorStarted(false), mVisible(true) { @@ -110,12 +100,8 @@ SceneHolder::~SceneHolder() mAdaptor->RemoveObserver(*mLifeCycleObserver.get()); mAdaptor->RemoveWindow(this); - if(mAdaptorStarted) - { - // The event queue is flushed and we wait for the completion of the surface removal - // Note : we don't need to delete surface when adaptor is stopped now. - mAdaptor->DeleteSurface(*mSurface.get()); - } + // The event queue is flushed and we wait for the completion of the surface removal + mAdaptor->DeleteSurface(*mSurface.get()); mAdaptor = nullptr; } @@ -239,7 +225,6 @@ void SceneHolder::SetAdaptor(Dali::Adaptor& adaptor) DALI_ASSERT_DEBUG(mSurface && "Surface needs to be set before calling this method\n"); - // We can assume that current adaptor is already started now. mAdaptorStarted = true; // Create the scene @@ -303,12 +288,6 @@ void SceneHolder::SetRotationCompletedAcknowledgement() void SceneHolder::FeedTouchPoint(Dali::Integration::Point& point, int timeStamp) { - if(DALI_UNLIKELY(!mAdaptorStarted)) - { - DALI_LOG_ERROR("Adaptor is stopped, or not be started yet. Ignore this feed.\n"); - return; - } - if(timeStamp < 1) { timeStamp = TimeService::GetMilliSeconds(); @@ -358,12 +337,6 @@ const Dali::HoverEvent& SceneHolder::GetLastHoverEvent() const void SceneHolder::FeedWheelEvent(Dali::Integration::WheelEvent& wheelEvent) { - if(DALI_UNLIKELY(!mAdaptorStarted)) - { - DALI_LOG_ERROR("Adaptor is stopped, or not be started yet. Ignore this feed.\n"); - return; - } - // Signals can be emitted while processing core events, and the scene holder could be deleted in the signal callback. // Keep the handle alive until the core events are processed. Dali::BaseHandle sceneHolder(this); @@ -377,12 +350,6 @@ void SceneHolder::FeedWheelEvent(Dali::Integration::WheelEvent& wheelEvent) void SceneHolder::FeedKeyEvent(Dali::Integration::KeyEvent& keyEvent) { - if(DALI_UNLIKELY(!mAdaptorStarted)) - { - DALI_LOG_ERROR("Adaptor is stopped, or not be started yet. Ignore this feed.\n"); - return; - } - Dali::PhysicalKeyboard physicalKeyboard = PhysicalKeyboard::Get(); if(physicalKeyboard) { @@ -403,12 +370,6 @@ void SceneHolder::FeedKeyEvent(Dali::Integration::KeyEvent& keyEvent) void SceneHolder::FeedHoverEvent(Dali::Integration::Point& point) { - if(DALI_UNLIKELY(!mAdaptorStarted)) - { - DALI_LOG_ERROR("Adaptor is stopped, or not be started yet. Ignore this feed.\n"); - return; - } - Integration::HoverEvent hoverEvent; // Signals can be emitted while processing core events, and the scene holder could be deleted in the signal callback. @@ -457,8 +418,6 @@ Dali::Integration::SceneHolder SceneHolder::Get(Dali::Actor actor) void SceneHolder::Reset() { - DALI_ASSERT_ALWAYS(mAdaptorStarted && "Adaptor is stopped, or not be started yet!"); - mCombiner.Reset(); // Any touch listeners should be told of the interruption. diff --git a/dali/integration-api/adaptor-framework/scene-holder-impl.h b/dali/integration-api/adaptor-framework/scene-holder-impl.h index 21c3c02..c4e8cdd 100644 --- a/dali/integration-api/adaptor-framework/scene-holder-impl.h +++ b/dali/integration-api/adaptor-framework/scene-holder-impl.h @@ -161,6 +161,16 @@ public: void Resume(); /** + * @brief Checks whether this scene holder is being deleted in the event thread. + * + * @return true if this scene holder is being deleted in the event thread, or false if not. + */ + bool IsBeingDeleted() const + { + return mIsBeingDeleted; + } + + /** * @brief Informs the scene that the set surface has been rotated. * * @param[in] width The width of rotated surface @@ -397,8 +407,10 @@ protected: Uint16Pair mDpi; ///< The DPI for this SceneHolder. - bool mAdaptorStarted; ///< Whether the adaptor has started or not - bool mVisible : 1; ///< Whether the scene is visible or not + std::atomic mIsBeingDeleted; ///< This is set only from the event thread and read only from the render thread + + bool mAdaptorStarted : 1; ///< Whether the adaptor has started or not + bool mVisible : 1; ///< Whether the scene is visible or not }; } // namespace Adaptor -- 2.7.4