Fix sigterm handler behavior 32/285032/2
authorChanggyu Choi <changyu.choi@samsung.com>
Mon, 5 Dec 2022 01:00:14 +0000 (10:00 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Mon, 5 Dec 2022 02:05:11 +0000 (11:05 +0900)
Some apps may need to call elm_exit().
This patch generalizes the termination logic by Exit().

Change-Id: I1242883c2515c7c2306f7464de5088257ae477b6
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
tizen-cpp/app-core-cpp/app_core_base.cc

index 03452e6..5bf9619 100644 (file)
@@ -1188,12 +1188,9 @@ void AppCoreBase::Init(int argc, char** argv) {
     OnLoopInit(argc, argv);
 
   signal(SIGTERM, [](int n) {
-    ecore_main_loop_thread_safe_call_sync(
-        [](void* data) -> void* {
-          _W("sigterm handler");
-          ecore_main_loop_quit();
-          return nullptr;
-        }, nullptr);
+    _W("sigterm handler");
+    if (context_ != nullptr)
+      context_->Exit();
   });
 
   traceEnd(TTRACE_TAG_APPLICATION_MANAGER);