summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2016-06-20 15:58:59 +0200
committerSebastian Dröge <sebastian@centricular.com>2017-05-17 15:36:12 +0300
commit9bf46a1065ee8430e072942f34d2504033fab633 (patch)
tree865b50e7e4f79cb95f8ce853b363d9cdcb6c381e
parentf119e93b47efb06ffc68c01d3e094d5346c30041 (diff)
gst: ref_sink() some more floating references returned by g_object_new()
https://bugzilla.gnome.org/show_bug.cgi?id=743062
-rw-r--r--gst/gstbin.c1
-rw-r--r--tests/check/gst/gstbin.c4
-rw-r--r--tests/check/gst/gstclock.c2
-rw-r--r--tests/check/gst/gstsystemclock.c3
4 files changed, 10 insertions, 0 deletions
diff --git a/gst/gstbin.c b/gst/gstbin.c
index e1389cd19..bcd6b6c20 100644
--- a/gst/gstbin.c
+++ b/gst/gstbin.c
@@ -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);
diff --git a/tests/check/gst/gstbin.c b/tests/check/gst/gstbin.c
index c24255307..fe41ac015 100644
--- a/tests/check/gst/gstbin.c
+++ b/tests/check/gst/gstbin.c
@@ -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);
diff --git a/tests/check/gst/gstclock.c b/tests/check/gst/gstclock.c
index a6ec723ca..3bf1db260 100644
--- a/tests/check/gst/gstclock.c
+++ b/tests/check/gst/gstclock.c
@@ -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);
diff --git a/tests/check/gst/gstsystemclock.c b/tests/check/gst/gstsystemclock.c
index 03ca2a361..b68d629c8 100644
--- a/tests/check/gst/gstsystemclock.c
+++ b/tests/check/gst/gstsystemclock.c
@@ -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);