mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
examples: fix bus/fd leak in hello world example
https://bugzilla.gnome.org/show_bug.cgi?id=683470
This commit is contained in:
parent
fe3efe2b75
commit
1ead500dad
1 changed files with 3 additions and 1 deletions
|
@ -38,6 +38,7 @@ main (gint argc, gchar * argv[])
|
|||
GstElement *playbin;
|
||||
GMainLoop *loop;
|
||||
GstBus *bus;
|
||||
guint bus_watch_id;
|
||||
gchar *uri;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
@ -65,7 +66,7 @@ main (gint argc, gchar * argv[])
|
|||
loop = g_main_loop_new (NULL, FALSE);
|
||||
|
||||
bus = gst_element_get_bus (playbin);
|
||||
gst_bus_add_watch (bus, bus_call, loop);
|
||||
bus_watch_id = gst_bus_add_watch (bus, bus_call, loop);
|
||||
g_object_unref (bus);
|
||||
|
||||
/* start play back and listed to events */
|
||||
|
@ -75,6 +76,7 @@ main (gint argc, gchar * argv[])
|
|||
/* cleanup */
|
||||
gst_element_set_state (playbin, GST_STATE_NULL);
|
||||
g_object_unref (playbin);
|
||||
g_source_remove (bus_watch_id);
|
||||
g_main_loop_unref (loop);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue