From: Hwankyu Jhun Date: Tue, 24 Sep 2024 23:02:31 +0000 (+0900) Subject: Add a fallback about register vconf events X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen_6.5;p=platform%2Fcore%2Fappfw%2Flaunchpad.git Add a fallback about register vconf events If calling the registration function is failed, the timer will be added to register vconf events properly. Change-Id: I23e6fb0a866bef13fcf30f8bdfe144f8e877c57e Signed-off-by: Hwankyu Jhun --- diff --git a/src/launchpad-process-pool/src/launchpad.c b/src/launchpad-process-pool/src/launchpad.c index 37fd7a3..2e6453e 100644 --- a/src/launchpad-process-pool/src/launchpad.c +++ b/src/launchpad-process-pool/src/launchpad.c @@ -2978,6 +2978,8 @@ static int __register_vconf_events(void) if (r != VCONF_OK) { _E("Failed to register callback for hw acceleration. err = %d", r); + __unregister_vconf_events(); + return -1; } lang = vconf_get_str(VCONFKEY_LANGSET); @@ -2987,8 +2989,11 @@ static int __register_vconf_events(void) } r = vconf_notify_key_changed(VCONFKEY_LANGSET, __update_lang, NULL); - if (r != VCONF_OK) + if (r != VCONF_OK) { _E("Failed to register callback for langset. err = %d", r); + __unregister_vconf_events(); + return -1; + } region = vconf_get_str(VCONFKEY_REGIONFORMAT); if (region) { @@ -2998,8 +3003,11 @@ static int __register_vconf_events(void) r = vconf_notify_key_changed(VCONFKEY_REGIONFORMAT, __region_format_changed_cb, NULL); - if (r != VCONF_OK) + if (r != VCONF_OK) { _E("Failed to register callback for regionformat. err = %d", r); + __unregister_vconf_events(); + return -1; + } type = CONFIG_TYPE_MEMORY_STATUS_LOW_KEY; key = _config_get_string_value(type); @@ -3012,8 +3020,11 @@ static int __register_vconf_events(void) r = vconf_notify_key_changed(key, __memory_status_low_changed_cb, NULL); - if (r != 0) + if (r != 0) { _E("Failed to register callback for low memory. err = %d", r); + __unregister_vconf_events(); + return -1; + } type = CONFIG_TYPE_MEMORY_STATUS_NORMAL_KEY; key = _config_get_string_value(type); @@ -3026,12 +3037,23 @@ static int __register_vconf_events(void) r = vconf_notify_key_changed(key, __memory_status_normal_changed_cb, NULL); - if (r != 0) + if (r != 0) { _E("Failed to register callback for normal memory. err = %d", r); + __unregister_vconf_events(); + return -1; + } return 0; } +static gboolean __vconf_init_cb(gpointer user_data) +{ + if (__register_vconf_events() != 0) + return G_SOURCE_CONTINUE; + + return G_SOURCE_REMOVE; +} + static bool __handle_logger(int fd, io_condition_e cond, void *data) { app_pkt_t *pkt; @@ -3220,7 +3242,10 @@ static int __before_loop(int argc, char **argv) if (ret < 0) return ret; - __register_vconf_events(); + ret = __register_vconf_events(); + if (ret != 0) + g_timeout_add(1000, __vconf_init_cb, NULL); + __init_app_defined_loader_monitor(); _memory_monitor_init(); _memory_monitor_set_event_cb(__memory_monitor_cb, NULL);