summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2017-05-15 18:58:38 +0300
committerSebastian Dröge <sebastian@centricular.com>2017-05-17 10:40:37 +0300
commitf119e93b47efb06ffc68c01d3e094d5346c30041 (patch)
tree8034fc373612c92b47c58dcbed41617b836da015
parent888fc33bc2aedb0fe6832cc104b83c22a348fd09 (diff)
gst: Clear floating flag in constructor of all GstObject subclasses that are not owned by any parent
I.e. most of them unfortunately. https://bugzilla.gnome.org/show_bug.cgi?id=743062
-rw-r--r--gst/gstbufferpool.c5
-rw-r--r--gst/gstdevicemonitor.c11
-rw-r--r--gst/gststreamcollection.c12
-rw-r--r--gst/gststreams.c11
-rw-r--r--gst/gsttracerrecord.c6
-rw-r--r--gst/gsttracerutils.c10
-rw-r--r--libs/gst/net/gstnettimeprovider.c5
7 files changed, 49 insertions, 11 deletions
diff --git a/gst/gstbufferpool.c b/gst/gstbufferpool.c
index 9529208aa..3d9123621 100644
--- a/gst/gstbufferpool.c
+++ b/gst/gstbufferpool.c
@@ -212,7 +212,7 @@ gst_buffer_pool_finalize (GObject * object)
*
* Creates a new #GstBufferPool instance.
*
- * Returns: (transfer floating): a new #GstBufferPool instance
+ * Returns: (transfer full): a new #GstBufferPool instance
*/
GstBufferPool *
gst_buffer_pool_new (void)
@@ -222,6 +222,9 @@ gst_buffer_pool_new (void)
result = g_object_new (GST_TYPE_BUFFER_POOL, NULL);
GST_DEBUG_OBJECT (result, "created new buffer pool");
+ /* Clear floating flag */
+ gst_object_ref_sink (result);
+
return result;
}
diff --git a/gst/gstdevicemonitor.c b/gst/gstdevicemonitor.c
index 123d2849a..add267ee0 100644
--- a/gst/gstdevicemonitor.c
+++ b/gst/gstdevicemonitor.c
@@ -785,14 +785,21 @@ gst_device_monitor_remove_filter (GstDeviceMonitor * monitor, guint filter_id)
*
* Create a new #GstDeviceMonitor
*
- * Returns: (transfer floating): a new device monitor.
+ * Returns: (transfer full): a new device monitor.
*
* Since: 1.4
*/
GstDeviceMonitor *
gst_device_monitor_new (void)
{
- return g_object_new (GST_TYPE_DEVICE_MONITOR, NULL);
+ GstDeviceMonitor *monitor;
+
+ monitor = g_object_new (GST_TYPE_DEVICE_MONITOR, NULL);
+
+ /* Clear floating flag */
+ gst_object_ref_sink (monitor);
+
+ return monitor;
}
/**
diff --git a/gst/gststreamcollection.c b/gst/gststreamcollection.c
index c1d4674d2..ef134b949 100644
--- a/gst/gststreamcollection.c
+++ b/gst/gststreamcollection.c
@@ -184,15 +184,23 @@ gst_stream_collection_finalize (GObject * object)
*
* Create a new #GstStreamCollection.
*
- * Returns: (transfer floating): The new #GstStreamCollection.
+ * Returns: (transfer full): The new #GstStreamCollection.
*
* Since: 1.10
*/
GstStreamCollection *
gst_stream_collection_new (const gchar * upstream_id)
{
- return g_object_new (GST_TYPE_STREAM_COLLECTION, "upstream-id", upstream_id,
+ GstStreamCollection *collection;
+
+ collection =
+ g_object_new (GST_TYPE_STREAM_COLLECTION, "upstream-id", upstream_id,
NULL);
+
+ /* Clear floating flag */
+ g_object_ref_sink (collection);
+
+ return collection;
}
static void
diff --git a/gst/gststreams.c b/gst/gststreams.c
index 8873aad56..f90d77148 100644
--- a/gst/gststreams.c
+++ b/gst/gststreams.c
@@ -210,7 +210,7 @@ gst_stream_finalize (GObject * object)
* Create a new #GstStream for the given @stream_id, @caps, @type
* and @flags
*
- * Returns: (transfer floating): The new #GstStream
+ * Returns: (transfer full): The new #GstStream
*
* Since: 1.10
*/
@@ -218,8 +218,15 @@ GstStream *
gst_stream_new (const gchar * stream_id, GstCaps * caps, GstStreamType type,
GstStreamFlags flags)
{
- return g_object_new (GST_TYPE_STREAM, "stream-id", stream_id, "caps", caps,
+ GstStream *stream;
+
+ stream = g_object_new (GST_TYPE_STREAM, "stream-id", stream_id, "caps", caps,
"stream-type", type, "stream-flags", flags, NULL);
+
+ /* Clear floating flag */
+ gst_object_ref_sink (stream);
+
+ return stream;
}
static void
diff --git a/gst/gsttracerrecord.c b/gst/gsttracerrecord.c
index 889479dce..2446a6e9c 100644
--- a/gst/gsttracerrecord.c
+++ b/gst/gsttracerrecord.c
@@ -178,7 +178,7 @@ gst_tracer_record_init (GstTracerRecord * self)
*
* > Please note that this is still under discussion and subject to change.
*
- * Returns: (transfer floating): a new #GstTracerRecord
+ * Returns: (transfer full): a new #GstTracerRecord
*/
GstTracerRecord *
gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...)
@@ -219,6 +219,10 @@ gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...)
va_end (varargs);
self = g_object_new (GST_TYPE_TRACER_RECORD, NULL);
+
+ /* Clear floating flag */
+ gst_object_ref_sink (self);
+
self->spec = structure;
gst_tracer_record_build_format (self);
diff --git a/gst/gsttracerutils.c b/gst/gsttracerutils.c
index c7786001f..053986915 100644
--- a/gst/gsttracerutils.c
+++ b/gst/gsttracerutils.c
@@ -114,12 +114,18 @@ _priv_gst_tracing_init (void)
if ((feature = gst_registry_lookup_feature (registry, t[i]))) {
factory = GST_TRACER_FACTORY (gst_plugin_feature_load (feature));
if (factory) {
+ GstTracer *tracer;
+
GST_INFO_OBJECT (factory, "creating tracer: type-id=%u",
(guint) factory->type);
+ tracer = g_object_new (factory->type, "params", params, NULL);
+
+ /* Clear floating flag */
+ gst_object_ref_sink (tracer);
+
/* tracers register them self to the hooks */
- gst_object_unref (g_object_new (factory->type, "params", params,
- NULL));
+ gst_object_unref (tracer);
} else {
GST_WARNING_OBJECT (feature,
"loading plugin containing feature %s failed!", t[i]);
diff --git a/libs/gst/net/gstnettimeprovider.c b/libs/gst/net/gstnettimeprovider.c
index 0c0ef69ca..f8e03088b 100644
--- a/libs/gst/net/gstnettimeprovider.c
+++ b/libs/gst/net/gstnettimeprovider.c
@@ -434,7 +434,7 @@ gst_net_time_provider_initable_iface_init (gpointer g_iface)
*
* Allows network clients to get the current time of @clock.
*
- * Returns: (transfer floating): the new #GstNetTimeProvider, or NULL on error
+ * Returns: (transfer full): the new #GstNetTimeProvider, or NULL on error
*/
GstNetTimeProvider *
gst_net_time_provider_new (GstClock * clock, const gchar * address, gint port)
@@ -448,5 +448,8 @@ gst_net_time_provider_new (GstClock * clock, const gchar * address, gint port)
g_initable_new (GST_TYPE_NET_TIME_PROVIDER, NULL, NULL, "clock", clock,
"address", address, "port", port, NULL);
+ /* Clear floating flag */
+ g_object_ref_sink (ret);
+
return ret;
}