summaryrefslogtreecommitdiff
path: root/dali
diff options
context:
space:
mode:
authorEunki, Hong <eunkiki.hong@samsung.com>2023-10-13 16:03:41 +0900
committerEunki, Hong <eunkiki.hong@samsung.com>2023-10-19 15:53:23 +0900
commit56e221c99d4bf17878f97ecaa8981c5a93fdb45b (patch)
tree27849f52b19a2429a73ce6e6ddb787888c5556e7 /dali
parentb5fb1f3b28e39d1c7d79b55dfabfeac0d39e17db (diff)
downloaddali-adaptor-56e221c99d4bf17878f97ecaa8981c5a93fdb45b.tar.gz
dali-adaptor-56e221c99d4bf17878f97ecaa8981c5a93fdb45b.tar.bz2
dali-adaptor-56e221c99d4bf17878f97ecaa8981c5a93fdb45b.zip
Ignore adaptor action when adpator is stop
There was some issue that ProcessEvents() called during app is terminating. When adaptor is Stop(), the update/render thread is already join. So we don't need to flush message queue. Change-Id: I229754fa7135d0c5f3a53dbcfeeeb17b2bc436f1 Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
Diffstat (limited to 'dali')
-rw-r--r--dali/integration-api/adaptor-framework/scene-holder-impl.cpp57
-rw-r--r--dali/integration-api/adaptor-framework/scene-holder-impl.h16
2 files changed, 51 insertions, 22 deletions
diff --git a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp
index e5703e470..6d281f61d 100644
--- a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp
+++ b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp
@@ -56,14 +56,24 @@ uint32_t SceneHolder::mSceneHolderCounter = 0;
class SceneHolder::SceneHolderLifeCycleObserver : public LifeCycleObserver
{
public:
- SceneHolderLifeCycleObserver(Adaptor*& adaptor)
- : mAdaptor(adaptor){};
+ SceneHolderLifeCycleObserver(Adaptor*& adaptor, bool& adaptorStarted)
+ : mAdaptor(adaptor),
+ mAdaptorStarted(adaptorStarted)
+ {
+ }
private: // Adaptor::LifeCycleObserver interface
- void OnStart() override{};
+ void OnStart() override
+ {
+ mAdaptorStarted = true;
+ };
void OnPause() override{};
void OnResume() override{};
- void OnStop() override{};
+ void OnStop() override
+ {
+ // Mark adaptor as stopped;
+ mAdaptorStarted = false;
+ };
void OnDestroy() override
{
mAdaptor = nullptr;
@@ -71,17 +81,17 @@ private: // Adaptor::LifeCycleObserver interface
private:
Adaptor*& mAdaptor;
+ bool& mAdaptorStarted;
};
SceneHolder::SceneHolder()
-: mLifeCycleObserver(new SceneHolderLifeCycleObserver(mAdaptor)),
+: mLifeCycleObserver(new SceneHolderLifeCycleObserver(mAdaptor, mAdaptorStarted)),
mLastTouchEvent(),
mLastHoverEvent(),
mId(mSceneHolderCounter++),
mSurface(nullptr),
mAdaptor(nullptr),
mDpi(),
- mIsBeingDeleted(false),
mAdaptorStarted(false),
mVisible(true)
{
@@ -100,8 +110,12 @@ SceneHolder::~SceneHolder()
mAdaptor->RemoveObserver(*mLifeCycleObserver.get());
mAdaptor->RemoveWindow(this);
- // The event queue is flushed and we wait for the completion of the surface removal
- mAdaptor->DeleteSurface(*mSurface.get());
+ 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());
+ }
mAdaptor = nullptr;
}
@@ -225,6 +239,7 @@ 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
@@ -288,6 +303,12 @@ 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();
@@ -337,6 +358,12 @@ 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);
@@ -350,6 +377,12 @@ 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)
{
@@ -370,6 +403,12 @@ 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.
@@ -418,6 +457,8 @@ 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 c4e8cdd20..21c3c0219 100644
--- a/dali/integration-api/adaptor-framework/scene-holder-impl.h
+++ b/dali/integration-api/adaptor-framework/scene-holder-impl.h
@@ -161,16 +161,6 @@ 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
@@ -407,10 +397,8 @@ protected:
Uint16Pair mDpi; ///< The DPI for this SceneHolder.
- std::atomic<bool> 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
+ bool mAdaptorStarted; ///< Whether the adaptor has started or not
+ bool mVisible : 1; ///< Whether the scene is visible or not
};
} // namespace Adaptor