tests: fix bus leaks

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
This commit is contained in:
Guillaume Desmottes 2016-07-12 16:45:36 +02:00 committed by Tim-Philipp Müller
parent 74177f9b6f
commit 94232da665
5 changed files with 11 additions and 5 deletions

View 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);
}

View 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);
}

View 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);
}

View 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);

View 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);
}