gst: ref_sink() some more floating references returned by g_object_new()

https://bugzilla.gnome.org/show_bug.cgi?id=743062
This commit is contained in:
Christoph Reiter 2016-06-20 15:58:59 +02:00 committed by Sebastian Dröge
parent f119e93b47
commit 9bf46a1065
4 changed files with 10 additions and 0 deletions

View file

@ -496,6 +496,7 @@ gst_bin_init (GstBin * bin)
/* Set up a bus for listening to child elements */
bus = g_object_new (GST_TYPE_BUS, "enable-async", FALSE, NULL);
gst_object_ref_sink (bus);
bin->child_bus = bus;
GST_DEBUG_OBJECT (bin, "using bus %" GST_PTR_FORMAT " to listen to children",
bus);

View file

@ -278,6 +278,7 @@ GST_START_TEST (test_message_state_changed)
ASSERT_OBJECT_REFCOUNT (bin, "bin", 1);
bus = g_object_new (gst_bus_get_type (), NULL);
gst_object_ref_sink (bus);
gst_element_set_bus (GST_ELEMENT_CAST (bin), bus);
/* change state, spawning a message, causing an incref on the bin */
@ -321,6 +322,7 @@ GST_START_TEST (test_message_state_changed_child)
ASSERT_OBJECT_REFCOUNT (bin, "bin", 1);
bus = g_object_new (gst_bus_get_type (), NULL);
gst_object_ref_sink (bus);
gst_element_set_bus (GST_ELEMENT_CAST (bin), bus);
src = gst_element_factory_make ("fakesrc", NULL);
@ -542,6 +544,7 @@ GST_START_TEST (test_watch_for_state_change)
fail_unless (bin != NULL, "Could not create bin");
bus = g_object_new (gst_bus_get_type (), NULL);
gst_object_ref_sink (bus);
gst_element_set_bus (GST_ELEMENT_CAST (bin), bus);
src = gst_element_factory_make ("fakesrc", NULL);
@ -606,6 +609,7 @@ GST_START_TEST (test_state_change_error_message)
fail_unless (bin != NULL, "Could not create bin");
bus = g_object_new (gst_bus_get_type (), NULL);
gst_object_ref_sink (bus);
gst_element_set_bus (GST_ELEMENT_CAST (bin), bus);
src = gst_element_factory_make ("fakesrc", NULL);

View file

@ -76,7 +76,9 @@ GST_START_TEST (test_set_master_refcount)
/* create master and slave */
master = g_object_new (TYPE_TEST_CLOCK, "name", "TestClockMaster", NULL);
gst_object_ref_sink (master);
slave = g_object_new (TYPE_TEST_CLOCK, "name", "TestClockSlave", NULL);
gst_object_ref_sink (slave);
GST_OBJECT_FLAG_SET (slave, GST_CLOCK_FLAG_CAN_SET_MASTER);
fail_unless_equals_int (GST_OBJECT_REFCOUNT (master), 1);

View file

@ -130,6 +130,7 @@ GST_START_TEST (test_set_default)
/* set a new default clock to a different instance which should replace the
* static clock with this one, and unref the static clock */
clock = g_object_new (GST_TYPE_SYSTEM_CLOCK, "name", "TestClock", NULL);
gst_object_ref_sink (clock);
gst_system_clock_set_default (clock);
g_assert_cmpint (GST_OBJECT_REFCOUNT (static_clock), ==, 1);
g_object_unref (static_clock);
@ -680,7 +681,9 @@ GST_START_TEST (test_async_full)
/* create master and slave */
master =
g_object_new (GST_TYPE_SYSTEM_CLOCK, "name", "TestClockMaster", NULL);
gst_object_ref_sink (master);
slave = g_object_new (GST_TYPE_SYSTEM_CLOCK, "name", "TestClockMaster", NULL);
gst_object_ref_sink (slave);
GST_OBJECT_FLAG_SET (slave, GST_CLOCK_FLAG_CAN_SET_MASTER);
g_object_set (slave, "timeout", 50 * GST_MSECOND, NULL);