From a90220cce1f4bbe9380c46b9f5458b90b0178a7c Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Wed, 4 Dec 2019 20:12:02 +0100 Subject: [PATCH] device, elementfactory: don't enforce floating status The reference we receive when calling g_object_new should be floating, but we can't force it at our level. Switch from g_object_force_floating() to a simple assertion. See https://gitlab.freedesktop.org/gstreamer/gst-python/issues/27 --- gst/gstdevice.c | 11 ++++++----- gst/gstelementfactory.c | 9 ++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gst/gstdevice.c b/gst/gstdevice.c index 64f5ba5309..bb7f303b53 100644 --- a/gst/gstdevice.c +++ b/gst/gstdevice.c @@ -212,11 +212,12 @@ gst_device_create_element (GstDevice * device, const gchar * name) if (klass->create_element) element = klass->create_element (device, name); - /* 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); + if (element) { + /* The reference we receive here should be floating, but we can't force + * it at our level. Simply assert to make the issue obvious to bindings + * developers */ + g_assert (g_object_is_floating ((GObject *) element)); + } return element; } diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c index 547fbd5a1e..5d457f1090 100644 --- a/gst/gstelementfactory.c +++ b/gst/gstelementfactory.c @@ -386,11 +386,10 @@ 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); + /* The reference we receive here should be floating, but we can't force + * it at our level. Simply assert to make the issue obvious to bindings + * developers */ + g_assert (g_object_is_floating ((GObject *) element)); GST_DEBUG ("created element \"%s\"", GST_OBJECT_NAME (factory)); -- 2.34.1