device, elementfactory: relax floating requirement

Using g_assert() is a bit too extreme, as it will abort the whole
program unless G_DISABLE_ASSERTS is true.

Switch to g_critical()
This commit is contained in:
Mathieu Duponchelle 2019-12-10 13:31:50 +01:00
parent 9861ad2e12
commit e79def14a5
2 changed files with 12 additions and 7 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);
if (element) { if (element && !g_object_is_floating ((GObject *) element)) {
/* The reference we receive here should be floating, but we can't force /* 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 * it at our level. Simply raise a critical to make the issue obvious to bindings
* developers */ * developers */
g_assert (g_object_is_floating ((GObject *) element)); g_critical ("The created element should be floating, "
"this is probably caused by faulty bindings");
} }
return element; return element;

View file

@ -386,10 +386,14 @@ 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);
if (!g_object_is_floating ((GObject *) element)) {
/* The reference we receive here should be floating, but we can't force /* 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 * it at our level. Simply raise a critical to make the issue obvious to bindings
* developers */ * users / developers */
g_assert (g_object_is_floating ((GObject *) element)); g_critical ("The created element should be floating, "
"this is probably caused by faulty bindings");
}
GST_DEBUG ("created element \"%s\"", GST_OBJECT_NAME (factory)); GST_DEBUG ("created element \"%s\"", GST_OBJECT_NAME (factory));