From: Hwankyu Jhun Date: Wed, 16 Aug 2017 12:00:39 +0000 (+0900) Subject: Fix service app finalization X-Git-Tag: accepted/tizen/3.0/common/20170818.112411^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Faccepted%2Ftizen_3.0_mobile;p=platform%2Fcore%2Fappfw%2Fappcore-agent.git Fix service app finalization While calling service_app_exit() or service_app_exit_without_restart(), the application sends the status dying event to the amd. If the initialization is failed, the aul_finalize() API will be called to release the resources about AUL. Change-Id: If131f838d478c02b9dd99bd1ff61dc4147375ddf Signed-off-by: Hwankyu Jhun --- diff --git a/src/appcore-agent.c b/src/appcore-agent.c index 0439166..2daace6 100644 --- a/src/appcore-agent.c +++ b/src/appcore-agent.c @@ -906,8 +906,10 @@ EXPORT_API int appcore_agent_init(const struct agent_ops *ops, goto err; r = aul_launch_argv_handler(argc, argv); - if (r < 0) + if (r < 0) { + aul_finalize(); goto err; + } core.ops = ops; core.state = 1; /* TODO: use enum value */ @@ -956,6 +958,7 @@ static int __before_loop(struct agent_priv *agent, int argc, char **argv) if (r < 0) { if (agent->ops && agent->ops->terminate) agent->ops->terminate(agent->ops->data); + aul_finalize(); ecore_shutdown(); errno = ECANCELED; return -1; @@ -972,13 +975,14 @@ static void __after_loop(struct agent_priv *agent) priv.state = AGS_DYING; if (agent->ops && agent->ops->terminate) agent->ops->terminate(agent->ops->data); + aul_finalize(); ecore_shutdown(); } EXPORT_API int appcore_agent_terminate() { __del_vconf_list(); - aul_finalize(); + aul_status_update(STATUS_DYING); ecore_main_loop_thread_safe_call_sync((Ecore_Data_Cb)__exit_loop, NULL); return 0; @@ -988,6 +992,7 @@ EXPORT_API int appcore_agent_terminate_without_restart() { __del_vconf_list(); aul_status_update(STATUS_NORESTART); + aul_status_update(STATUS_DYING); ecore_main_loop_thread_safe_call_sync((Ecore_Data_Cb)__exit_loop, NULL); return 0;