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