Commit 4a41468c authored by Guillaume Desmottes's avatar Guillaume Desmottes 🐐 Committed by Tim-Philipp Müller

Use MAY_BE_LEAKED_FLAG

This helps having "make check" passing with the leaks tracer enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=766008
parent 21070c81
......@@ -423,6 +423,9 @@ gst_static_caps_get (GstStaticCaps * static_caps)
*caps = gst_caps_from_string (string);
/* Caps generated from static caps are usually leaked */
GST_MINI_OBJECT_FLAG_SET (*caps, GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
/* convert to string */
if (G_UNLIKELY (*caps == NULL))
g_critical ("Could not convert static caps \"%s\"", string);
......
......@@ -294,8 +294,12 @@ gst_device_provider_factory_get (GstDeviceProviderFactory * factory)
* an device provider at the same moment
*/
oclass = GST_DEVICE_PROVIDER_GET_CLASS (device_provider);
if (!g_atomic_pointer_compare_and_exchange (&oclass->factory, NULL, factory))
if (!g_atomic_pointer_compare_and_exchange (&oclass->factory, NULL, factory)) {
gst_object_unref (factory);
} else {
/* This ref will never be dropped as the class is never destroyed */
GST_OBJECT_FLAG_SET (factory, GST_OBJECT_FLAG_MAY_BE_LEAKED);
}
gst_object_ref_sink (device_provider);
......
......@@ -386,6 +386,9 @@ gst_element_factory_create (GstElementFactory * factory, const gchar * name)
if (!g_atomic_pointer_compare_and_exchange (&oclass->elementfactory, NULL,
factory))
gst_object_unref (factory);
else
/* This ref will never be dropped as the class is never destroyed */
GST_OBJECT_FLAG_SET (factory, GST_OBJECT_FLAG_MAY_BE_LEAKED);
GST_DEBUG ("created element \"%s\"", GST_OBJECT_NAME (factory));
......
......@@ -200,6 +200,8 @@ gst_pad_template_class_init (GstPadTemplateClass * klass)
static void
gst_pad_template_init (GstPadTemplate * templ)
{
/* GstPadTemplate objects are usually leaked */
GST_OBJECT_FLAG_SET (templ, GST_OBJECT_FLAG_MAY_BE_LEAKED);
}
static void
......@@ -395,6 +397,9 @@ gst_pad_template_set_property (GObject * object, guint prop_id,
break;
case PROP_CAPS:
GST_PAD_TEMPLATE_CAPS (object) = g_value_dup_boxed (value);
/* GstPadTemplate are usually leaked so are their caps */
GST_MINI_OBJECT_FLAG_SET (GST_PAD_TEMPLATE_CAPS (object),
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
......
......@@ -163,6 +163,8 @@ init_klass_pool (GstTaskClass * klass)
gst_object_unref (klass->pool);
}
klass->pool = gst_task_pool_new ();
/* Classes are never destroyed so this ref will never be dropped */
GST_OBJECT_FLAG_SET (klass->pool, GST_OBJECT_FLAG_MAY_BE_LEAKED);
gst_task_pool_prepare (klass->pool, NULL);
g_mutex_unlock (&pool_lock);
}
......
......@@ -1332,6 +1332,11 @@ gst_net_client_clock_constructed (GObject * object)
self->priv->address, "port", self->priv->port, "is-ntp",
self->priv->is_ntp, NULL);
clocks = g_list_prepend (clocks, cache);
/* Not actually leaked but is cached for a while before being disposed,
* see gst_net_client_clock_finalize, so pretend it is to not confuse
* tests. */
GST_OBJECT_FLAG_SET (cache->clock, GST_OBJECT_FLAG_MAY_BE_LEAKED);
}
cache->clocks = g_list_prepend (cache->clocks, self);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment