Fix ecore timer of error cb 93/135193/1
authorsooyeon.kim <sooyeon.kim@samsung.com>
Fri, 16 Jun 2017 10:45:46 +0000 (19:45 +0900)
committerSooyeon Kim <sooyeon.kim@samsung.com>
Wed, 21 Jun 2017 07:01:51 +0000 (07:01 +0000)
Change-Id: I3944d63256bc2907da51b4f9bf2e2589db295553
Signed-off-by: sooyeon.kim <sooyeon.kim@samsung.com>
(cherry picked from commit 27612f966d347df9f42c93c6d328b65a971801b3)

client/stt.c

index 6ad5d1a..fe24360 100644 (file)
@@ -35,7 +35,7 @@
 
 
 static void __stt_notify_state_changed(void *data);
-static Eina_Bool __stt_notify_error(void *data);
+static void __stt_notify_error(void *data);
 
 static Ecore_Timer* g_connect_timer = NULL;
 static float g_volume_db = 0;
@@ -950,7 +950,7 @@ static Eina_Bool __stt_connect_daemon(void *data)
                SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to initialize : %s", __stt_get_error_code(ret));
 
                client->reason = STT_ERROR_ENGINE_NOT_FOUND;
-               ecore_timer_add(0, __stt_notify_error, (void*)client);
+               ecore_main_loop_thread_safe_call_async(__stt_notify_error, (void*)client);
 
                return EINA_FALSE;
 
@@ -1856,7 +1856,7 @@ int stt_foreach_detailed_result(stt_h stt, stt_result_time_cb callback, void* us
        return ret;
 }
 
-static Eina_Bool __stt_notify_error(void *data)
+static void __stt_notify_error(void *data)
 {
        stt_client_s* client = (stt_client_s*)data;
 
@@ -1865,11 +1865,11 @@ static Eina_Bool __stt_notify_error(void *data)
        /* check handle */
        if (NULL == client) {
                SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to notify error : A handle is not valid");
-               return EINA_FALSE;
+               return;
        }
 
        if (NULL == stt_client_get_by_uid(client->uid))
-               return EINA_FALSE;
+               return;
 
        if (NULL != client->error_cb) {
                stt_client_use_callback(client);
@@ -1882,7 +1882,7 @@ static Eina_Bool __stt_notify_error(void *data)
                SLOG(LOG_WARN, TAG_STTC, "[WARNING] Error callback is null");
        }
 
-       return EINA_FALSE;
+       return;
 }
 
 int __stt_cb_error(int uid, int reason, char* err_msg)
@@ -1913,7 +1913,7 @@ int __stt_cb_error(int uid, int reason, char* err_msg)
                                SLOG(LOG_INFO, TAG_STTC, "internal state is initialized to 0");
 
                                if (NULL != data->error_cb) {
-                                       ecore_timer_add(0, __stt_notify_error, data);
+                                       ecore_main_loop_thread_safe_call_async(__stt_notify_error, data);
                                } else {
                                        SLOG(LOG_WARN, TAG_STTC, "[WARNING] Error callback is null");
                                }
@@ -1950,7 +1950,7 @@ int __stt_cb_error(int uid, int reason, char* err_msg)
                SLOG(LOG_INFO, TAG_STTC, "internal state is initialized to 0");
 
                if (NULL != client->error_cb) {
-                       ecore_timer_add(0, __stt_notify_error, client);
+                       ecore_main_loop_thread_safe_call_async(__stt_notify_error, client);
                } else {
                        SLOG(LOG_WARN, TAG_STTC, "[WARNING] Error callback is null");
                }