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
This commit is contained in:
Sebastian Dröge 2017-05-15 18:58:38 +03:00
parent 888fc33bc2
commit f119e93b47
7 changed files with 49 additions and 11 deletions

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

View 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;
}
/**

View 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

View 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

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

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

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