mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
device: Enforce that elements created by gst_device_create_element() 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
This commit is contained in:
parent
1edcf747ee
commit
341ee45155
1 changed files with 10 additions and 3 deletions
|
@ -205,13 +205,20 @@ GstElement *
|
||||||
gst_device_create_element (GstDevice * device, const gchar * name)
|
gst_device_create_element (GstDevice * device, const gchar * name)
|
||||||
{
|
{
|
||||||
GstDeviceClass *klass = GST_DEVICE_GET_CLASS (device);
|
GstDeviceClass *klass = GST_DEVICE_GET_CLASS (device);
|
||||||
|
GstElement *element = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_DEVICE (device), NULL);
|
g_return_val_if_fail (GST_IS_DEVICE (device), NULL);
|
||||||
|
|
||||||
if (klass->create_element)
|
if (klass->create_element)
|
||||||
return klass->create_element (device, name);
|
element = klass->create_element (device, name);
|
||||||
else
|
|
||||||
return NULL;
|
/* 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);
|
||||||
|
|
||||||
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue