Fix thread bug for error handling 82/86482/1 accepted/tizen/common/20160901.143618 accepted/tizen/ivi/20160902.011757 accepted/tizen/mobile/20160902.013050 accepted/tizen/tv/20160902.012203 accepted/tizen/wearable/20160902.011746 submit/tizen/20160901.111640
authorKwangyoun Kim <ky85.kim@samsung.com>
Thu, 1 Sep 2016 10:34:01 +0000 (19:34 +0900)
committerKwangyoun Kim <ky85.kim@samsung.com>
Thu, 1 Sep 2016 10:34:01 +0000 (19:34 +0900)
Change-Id: I0a6d59803e201f15962768e67141f9c15926b104

server/sttd_engine_agent.c

index 81417d5..3bf7095 100644 (file)
@@ -1068,6 +1068,15 @@ int sttd_engine_agent_check_app_agreed(const char* appid, bool* result)
        return 0;
 }
 
+static void __recorder_destroy_by_error_result(void *data)
+{
+       SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] Destroy recorder");
+       if (0 != sttd_recorder_destroy())
+               SECURE_SLOG(LOG_WARN, TAG_STTD, "[Engine Agent] Fail to destroy recorder");
+
+       return;
+}
+
 int sttd_engine_agent_send_result(stte_result_event_e event, const char* type, const char** result, int result_count,
                 const char* msg, void* time_info, void *user_data)
 {
@@ -1093,9 +1102,7 @@ int sttd_engine_agent_send_result(stte_result_event_e event, const char* type, c
 
 #ifdef AUDIO_CREATE_ON_START
        if (event == STTE_RESULT_EVENT_ERROR) {
-               SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] Destroy recorder");
-               if (0 != sttd_recorder_destroy())
-                       SECURE_SLOG(LOG_WARN, TAG_STTD, "[Engine Agent] Fail to destroy recorder");
+               ecore_main_loop_thread_safe_call_async(__recorder_destroy_by_error_result, NULL);
        }
 #endif