From ce43de86902c4e9c8ed4e9682602664cb9bce2ee Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 12 Sep 2019 10:09:18 +0300 Subject: [PATCH] element: Enforce that elements created by gst_element_factory_create/make() are floating Bindings might have a hard time making sure that the reference is indeed still floating after returning here. See https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/444 --- gst/gstelementfactory.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c index cf3b100..3ccfc14 100644 --- a/gst/gstelementfactory.c +++ b/gst/gstelementfactory.c @@ -386,6 +386,12 @@ gst_element_factory_create (GstElementFactory * factory, const gchar * name) /* This ref will never be dropped as the class is never destroyed */ GST_OBJECT_FLAG_SET (factory, GST_OBJECT_FLAG_MAY_BE_LEAKED); + /* Ensure that the reference is floating. Bindings might have a hard time + * making sure that the reference is indeed still floating after returning + * here */ + if (element) + g_object_force_floating ((GObject *) element); + GST_DEBUG ("created element \"%s\"", GST_OBJECT_NAME (factory)); return element; -- 2.7.4