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
This commit is contained in:
Mathieu Duponchelle 2019-12-04 20:12:02 +01:00 committed by GStreamer Merge Bot
parent f05ba0aea7
commit a90220cce1
2 changed files with 10 additions and 10 deletions

View file

@ -212,11 +212,12 @@ gst_device_create_element (GstDevice * device, const gchar * name)
if (klass->create_element) if (klass->create_element)
element = klass->create_element (device, name); element = klass->create_element (device, name);
/* Ensure that the reference is floating. Bindings might have a hard time if (element) {
* making sure that the reference is indeed still floating after returning /* The reference we receive here should be floating, but we can't force
* here */ * it at our level. Simply assert to make the issue obvious to bindings
if (element) * developers */
g_object_force_floating ((GObject *) element); g_assert (g_object_is_floating ((GObject *) element));
}
return element; return element;
} }

View file

@ -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 */ /* 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_FLAG_SET (factory, GST_OBJECT_FLAG_MAY_BE_LEAKED);
/* Ensure that the reference is floating. Bindings might have a hard time /* The reference we receive here should be floating, but we can't force
* making sure that the reference is indeed still floating after returning * it at our level. Simply assert to make the issue obvious to bindings
* here */ * developers */
if (element) g_assert (g_object_is_floating ((GObject *) element));
g_object_force_floating ((GObject *) element);
GST_DEBUG ("created element \"%s\"", GST_OBJECT_NAME (factory)); GST_DEBUG ("created element \"%s\"", GST_OBJECT_NAME (factory));