gst: Clear floating flag in constructor of all GstObject subclasses that are not...
authorSebastian Dröge <sebastian@centricular.com>
Mon, 15 May 2017 15:58:38 +0000 (18:58 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Wed, 17 May 2017 07:40:37 +0000 (10:40 +0300)
I.e. most of them unfortunately.

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

gst/gstbufferpool.c
gst/gstdevicemonitor.c
gst/gststreamcollection.c
gst/gststreams.c
gst/gsttracerrecord.c
gst/gsttracerutils.c
libs/gst/net/gstnettimeprovider.c

index 9529208..3d91236 100644 (file)
@@ -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;
 }
 
index 123d284..add267e 100644 (file)
@@ -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;
 }
 
 /**
index c1d4674..ef134b9 100644 (file)
@@ -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
index 8873aad..f90d771 100644 (file)
@@ -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
index 889479d..2446a6e 100644 (file)
@@ -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);
 
index c778600..0539869 100644 (file)
@@ -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]);
index 0c0ef69..f8e0308 100644 (file)
@@ -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;
 }