From 8f595cedfc0d1af4d10d2e58c3ebe494a15d6efc Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 19 Mar 2021 11:13:44 +0900 Subject: [PATCH] Fix wrong implemenation of component lifecycle If the state is running, the component should not go to the started state. Change-Id: I11cd3eb1f9c440d78c8079ad9fd3c9088aa2b8c7 Signed-off-by: Hwankyu Jhun --- component_based/base/component.cc | 8 ++++++-- component_based/base/frame_component.cc | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/component_based/base/component.cc b/component_based/base/component.cc index a8cc61c..8b2d1cf 100644 --- a/component_based/base/component.cc +++ b/component_based/base/component.cc @@ -65,8 +65,12 @@ void Component::Impl::OnDestroy() { void Component::Impl::OnStart(AppControl control, bool restarted) { parent_->OnBaseStart(control, restarted); - state_ = State::Started; - aul_comp_status_update(inst_id_.c_str(), COMP_STATUS_STARTED); + if (state_ == State::Created || + state_ == State::Paused || + state_ == State::Stopped) { + state_ = State::Started; + aul_comp_status_update(inst_id_.c_str(), COMP_STATUS_STARTED); + } } void Component::Impl::OnResume() { diff --git a/component_based/base/frame_component.cc b/component_based/base/frame_component.cc index 399aa7e..5d7646f 100644 --- a/component_based/base/frame_component.cc +++ b/component_based/base/frame_component.cc @@ -76,6 +76,9 @@ void FrameComponent::OnBaseDestroy() { } void FrameComponent::OnBaseStart(AppControl control, bool restarted) { + if (GetState() == State::Running) + return; + tizen_base::Bundle content = GetContent(); OnBaseRestoreContent(content); OnStart(control, restarted); -- 2.34.1