Wait to destroy the client memory until to close the data channel 55/44955/1 accepted/tizen/mobile/20150731.102630 accepted/tizen/tv/20150731.102752 accepted/tizen/wearable/20150731.102919 submit/tizen/20150731.053257
authorHyongtaek Lim <hyongtaek.lim@samsung.com>
Thu, 30 Jul 2015 05:40:45 +0000 (14:40 +0900)
committerHyongtaek Lim <hyongtaek.lim@samsung.com>
Thu, 30 Jul 2015 05:41:59 +0000 (14:41 +0900)
Signed-off-by: Hyongtaek Lim <hyongtaek.lim@samsung.com>
Change-Id: I3c92bebb5d5d082053b21de393349e9ac2590115

src/mmsvc_core_ipc.c

index e3368e5..93b04d3 100644 (file)
@@ -103,6 +103,9 @@ static gpointer _mmsvc_core_ipc_dispatch_worker(gpointer data)
                                                LOGD("DESTROY");
                                                mmsvc_core_module_dll_symbol(cmd, client);
                                                g_queue_free(client->ch[MUSED_CHANNEL_DATA].queue);
+                                               client->ch[MUSED_CHANNEL_DATA].queue = NULL;
+                                               g_cond_broadcast(&client->ch[MUSED_CHANNEL_DATA].cond);
+                                               g_thread_join(client->ch[MUSED_CHANNEL_DATA].p_gthread);
                                                g_mutex_clear(&client->ch[MUSED_CHANNEL_DATA].mutex);
                                                g_cond_clear(&client->ch[MUSED_CHANNEL_DATA].cond);
                                                mmsvc_core_module_close(client);
@@ -339,6 +342,7 @@ char *mmsvc_core_ipc_get_data(Client client)
        gint64 end_time = g_get_monotonic_time() + 100 * G_TIME_SPAN_MILLISECOND;
        g_return_val_if_fail(client, NULL);
        ch = &client->ch[MUSED_CHANNEL_DATA];
+       g_return_val_if_fail(ch->queue, NULL);
 
        g_mutex_lock(&ch->mutex);
        if (g_queue_is_empty(ch->queue))