From: Ji-hoon Lee Date: Wed, 26 Feb 2020 07:49:22 +0000 (+0900) Subject: Make sure timer related functions are called in main thread X-Git-Tag: submit/tizen_5.5/20200409.014144~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d60af7abc2f99a1b6a0bbc646ac33f065f859e1f;p=platform%2Fcore%2Fuifw%2Fmulti-assistant.git Make sure timer related functions are called in main thread Change-Id: I3180942cf551a779140f25d3227430122e3a6f96 --- diff --git a/client/ma.c b/client/ma.c index 673d282..7df5770 100644 --- a/client/ma.c +++ b/client/ma.c @@ -388,9 +388,10 @@ static Ecore_Timer* g_retry_connection_timer = NULL; static int g_retry_connection_count = 0; static Eina_Bool retry_connection(void* data) { + MA_SLOGI("[ENTER]"); int ret = ma_dbus_request_hello(); if (ret == 0) { - MA_SLOGD("Success to request hello. retry count(%d)", g_retry_connection_count); + MA_SLOGI("Success to request hello. retry count(%d)", g_retry_connection_count); g_retry_connection_count = 0; if (g_retry_connection_timer) ecore_timer_del(g_retry_connection_timer); g_retry_connection_timer = NULL; @@ -418,10 +419,26 @@ static Eina_Bool retry_connection(void* data) return ECORE_CALLBACK_RENEW; } +static void delete_retry_connection_timer(void* data) +{ + if (g_retry_connection_timer) { + ecore_timer_del(g_retry_connection_timer); + g_retry_connection_timer = NULL; + } +} + +static void add_retry_connection_timer(void* data) +{ + delete_retry_connection_timer(NULL); + + g_retry_connection_timer = ecore_timer_add(1.5f, retry_connection, NULL); + MA_SLOGI("Added timer for retry_connection : %p", g_retry_connection_timer); +} + static void __start_prepare_func() { if (ECORE_CALLBACK_RENEW == retry_connection(NULL)) { - ecore_timer_add(1.5f, retry_connection, NULL); + ecore_main_loop_thread_safe_call_async(add_retry_connection_timer, NULL); } } @@ -473,8 +490,8 @@ int ma_unprepare(void) MA_SLOGI("[Client DEBUG] Unprepare"); - if (g_retry_connection_timer) ecore_timer_del(g_retry_connection_timer); - g_retry_connection_timer = NULL; + MA_SLOGD("Deleting timer for retry_connection"); + ecore_main_loop_thread_safe_call_async(delete_retry_connection_timer, NULL); ma_state_e state; diff --git a/client/ma_dbus.c b/client/ma_dbus.c index f7acf8f..0111bb6 100644 --- a/client/ma_dbus.c +++ b/client/ma_dbus.c @@ -662,7 +662,7 @@ int ma_dbus_request_hello() result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, 1000, &err); if (dbus_error_is_set(&err)) { - MA_SLOGE("[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Dbus Error (%s) %p", err.message, result_msg); //LCOV_EXCL_LINE dbus_error_free(&err); }