tests: fix bus leaks
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 12 Jul 2016 14:45:36 +0000 (16:45 +0200)
committerTim-Philipp Müller <tim@centricular.com>
Mon, 18 Jul 2016 09:53:19 +0000 (10:53 +0100)
gst_bus_add_signal_watch() takes a ref on the bus which should be
released using gst_bus_remove_signal_watch().

https://bugzilla.gnome.org/show_bug.cgi?id=768739

tests/check/elements/audiofirfilter.c
tests/check/elements/audioiirfilter.c
tests/check/elements/rtp-payloading.c
tests/check/elements/videobox.c
tests/check/pipelines/effectv.c

index dd31e87..d8b452c 100644 (file)
@@ -158,7 +158,6 @@ GST_START_TEST (test_pipeline)
   bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
   gst_bus_add_signal_watch (bus);
   g_signal_connect (G_OBJECT (bus), "message", G_CALLBACK (on_message), loop);
-  gst_object_unref (GST_OBJECT (bus));
 
   fail_if (gst_element_set_state (pipeline,
           GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE);
@@ -171,6 +170,8 @@ GST_START_TEST (test_pipeline)
   fail_unless (gst_element_set_state (pipeline,
           GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS);
 
+  gst_bus_remove_signal_watch (bus);
+  gst_object_unref (GST_OBJECT (bus));
   g_main_loop_unref (loop);
   gst_object_unref (pipeline);
 }
index 8faae79..af2c9d3 100644 (file)
@@ -155,7 +155,6 @@ GST_START_TEST (test_pipeline)
   bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
   gst_bus_add_signal_watch (bus);
   g_signal_connect (G_OBJECT (bus), "message", G_CALLBACK (on_message), loop);
-  gst_object_unref (GST_OBJECT (bus));
 
   fail_if (gst_element_set_state (pipeline,
           GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE);
@@ -168,6 +167,8 @@ GST_START_TEST (test_pipeline)
   fail_unless (gst_element_set_state (pipeline,
           GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS);
 
+  gst_bus_remove_signal_watch (bus);
+  gst_object_unref (GST_OBJECT (bus));
   g_main_loop_unref (loop);
   gst_object_unref (pipeline);
 }
index 96a601e..dda9c42 100644 (file)
@@ -299,7 +299,6 @@ rtp_pipeline_run (rtp_pipeline * p)
   bus = gst_pipeline_get_bus (GST_PIPELINE (p->pipeline));
 
   gst_bus_add_watch (bus, rtp_bus_callback, (gpointer) mainloop);
-  gst_object_unref (bus);
 
   /* Set pipeline to PLAYING. */
   gst_element_set_state (p->pipeline, GST_STATE_PLAYING);
@@ -354,6 +353,9 @@ rtp_pipeline_run (rtp_pipeline * p)
   /* Release mainloop. */
   g_main_loop_unref (mainloop);
 
+  gst_bus_remove_watch (bus);
+  gst_object_unref (bus);
+
   fail_if (p->custom_event);
 }
 
index ec4825a..2d26535 100644 (file)
@@ -163,7 +163,6 @@ GST_START_TEST (test_caps_transform)
   fail_unless (bus != NULL);
 
   gst_bus_add_watch (bus, bus_handler, loop);
-  gst_object_unref (bus);
 
   conversions_test_size = G_N_ELEMENTS (conversion_table);
   for (itr = 0; itr < conversions_test_size; itr++) {
@@ -200,6 +199,8 @@ GST_START_TEST (test_caps_transform)
         "couldn't set pipeline to READY state");
   }
 
+  gst_bus_remove_watch (bus);
+  gst_object_unref (bus);
   g_main_loop_unref (loop);
 
   videobox_test_deinit_context (&ctx);
index 6c25e4b..a14806e 100644 (file)
@@ -72,7 +72,6 @@ run_test (const gchar * pipeline_string)
 
   g_signal_connect (bus, "message", (GCallback) on_message_cb, &omud);
 
-  gst_object_unref (bus);
 
   ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
   fail_unless (ret == GST_STATE_CHANGE_SUCCESS
@@ -85,6 +84,8 @@ run_test (const gchar * pipeline_string)
 
   fail_unless (omud.eos == TRUE);
 
+  gst_bus_remove_signal_watch (bus);
+  gst_object_unref (bus);
   gst_object_unref (pipeline);
   g_main_loop_unref (loop);
 }