[UTC][player][Non-ACR][Use default context for timeout_funct]
authorEunhae Choi <eunhae1.choi@samsung.com>
Tue, 27 Sep 2016 11:04:57 +0000 (20:04 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Tue, 27 Sep 2016 11:05:07 +0000 (20:05 +0900)
Change-Id: Iec78aeb9c876d6ef4161787de75f0d8ad3b11ac7

src/utc/player/utc-media-player-callback.c

index 5f9849aa4ce6adc806f4962a0b9a54c1903e9c58..1ec35318d382bd5ef2f3a528d4c00733d44eb108 100755 (executable)
@@ -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;
 }
 
 /**