Fix bug NULL is passed on streaming failure event 28/240528/2
authorJi-hoon Lee <dalton.lee@samsung.com>
Fri, 7 Aug 2020 06:25:06 +0000 (15:25 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Fri, 7 Aug 2020 08:41:32 +0000 (17:41 +0900)
Change-Id: I5b2900a9110d10051bfa028deb0ab5adf5f24a4e

src/service_plugin.cpp

index ca4416c..254fb8e 100644 (file)
@@ -350,8 +350,15 @@ void handle_speech_streaming_event_failure(void* data)
 
 static void __audio_streaming_cb(mas_speech_streaming_event_e event, void* buffer, int len, void *user_data)
 {
+       CServicePlugin* plugin = static_cast<CServicePlugin*>(user_data);
+
        if (event == MAS_SPEECH_STREAMING_EVENT_FAIL) {
-               ecore_main_loop_thread_safe_call_async(handle_speech_streaming_event_failure, NULL);
+               AsyncParam* param = new(std::nothrow) AsyncParam;
+               if (param) {
+                       param->plugin = plugin;
+                       ecore_main_loop_thread_safe_call_async(
+                               handle_speech_streaming_event_failure, static_cast<void*>(param));
+               }
                return;
        }
        static int count = 0;
@@ -361,7 +368,6 @@ static void __audio_streaming_cb(mas_speech_streaming_event_e event, void* buffe
        }
        ++count;
 
-       CServicePlugin* plugin = static_cast<CServicePlugin*>(user_data);
        CServiceIpcDbus* service_ipc = nullptr;
        CServiceMain* service_main = nullptr;
        if (plugin) {