Fix wrong implemenation of component lifecycle 91/255491/1
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 19 Mar 2021 02:13:44 +0000 (11:13 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 19 Mar 2021 02:13:44 +0000 (11:13 +0900)
If the state is running, the component should not go to the started state.

Change-Id: I11cd3eb1f9c440d78c8079ad9fd3c9088aa2b8c7
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
component_based/base/component.cc
component_based/base/frame_component.cc

index a8cc61ca608263c27376cd160654880fb4e33e35..8b2d1cf05d3a002fdcc7dd5609e364ea575ea9ec 100644 (file)
@@ -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() {
index 399aa7e0c87e77187937df2532d35138ca4689cd..5d7646fcc5a6301d67f26eb038e5973969513d70 100644 (file)
@@ -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);