From: Eunhae Choi Date: Tue, 27 Sep 2016 11:04:57 +0000 (+0900) Subject: [UTC][player][Non-ACR][Use default context for timeout_funct] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=957668851cf0b195b491420ccd243023e95fce18;p=test%2Ftct%2Fnative%2Fapi.git [UTC][player][Non-ACR][Use default context for timeout_funct] Change-Id: Iec78aeb9c876d6ef4161787de75f0d8ad3b11ac7 --- diff --git a/src/utc/player/utc-media-player-callback.c b/src/utc/player/utc-media-player-callback.c index 5f9849aa4..1ec35318d 100755 --- a/src/utc/player/utc-media-player-callback.c +++ b/src/utc/player/utc-media-player-callback.c @@ -46,28 +46,14 @@ static gboolean timeout_func(gpointer data) static void wait_for_async() { - GMainContext *context = g_main_context_new(); - GSource *source = g_timeout_source_new(5000); - - /* attach source to context */ - g_source_attach (source, context); - - g_mainloop = g_main_loop_new(context, FALSE); - - /* set the callback for this source */ - g_source_set_callback (source, timeout_func, g_mainloop, NULL); - - g_main_loop_run(g_mainloop); - - /* after attaching with the GSource, destroy() is needed */ - g_source_destroy(source); - - /* unref the last reference we got for GSource */ - g_source_unref(source); - - /* main loop should be destroyed before unref the context */ - g_main_loop_unref(g_mainloop); - g_main_context_unref(context); + int timeout_id; + g_mainloop = g_main_loop_new(NULL, FALSE); + + timeout_id = g_timeout_add(5000, timeout_func, g_mainloop); + g_main_loop_run(g_mainloop); + g_source_remove(timeout_id); + g_main_loop_unref(g_mainloop); + g_mainloop = NULL; } /**