mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
Fix refcounting of gst_plugin_feature_load to match the docs.
Original commit message from CVS: * gst/gstelementfactory.c: (gst_element_factory_create): * gst/gstpluginfeature.c: (gst_plugin_feature_load): * gst/gsttypefindfactory.c: (gst_type_find_factory_call_function): * tools/gst-inspect.c: (print_element_info): Fix refcounting of gst_plugin_feature_load to match the docs. Fixes: #380129
This commit is contained in:
parent
8dbb58093f
commit
1cca54b44c
5 changed files with 21 additions and 4 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2006-12-07 Jan Schmidt <thaytan@mad.scientist.com>
|
||||||
|
|
||||||
|
* gst/gstelementfactory.c: (gst_element_factory_create):
|
||||||
|
* gst/gstpluginfeature.c: (gst_plugin_feature_load):
|
||||||
|
* gst/gsttypefindfactory.c: (gst_type_find_factory_call_function):
|
||||||
|
* tools/gst-inspect.c: (print_element_info):
|
||||||
|
Fix refcounting of gst_plugin_feature_load to match the docs.
|
||||||
|
Fixes: #380129
|
||||||
|
|
||||||
2006-12-07 Wim Taymans <wim@fluendo.com>
|
2006-12-07 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* libs/gst/base/gstbasesink.c: (gst_base_sink_event),
|
* libs/gst/base/gstbasesink.c: (gst_base_sink_event),
|
||||||
|
|
|
@ -379,14 +379,18 @@ gst_element_factory_create (GstElementFactory * factory, const gchar * name)
|
||||||
|
|
||||||
/* create an instance of the element, cast so we don't assert on NULL */
|
/* create an instance of the element, cast so we don't assert on NULL */
|
||||||
element = GST_ELEMENT_CAST (g_object_new (factory->type, NULL));
|
element = GST_ELEMENT_CAST (g_object_new (factory->type, NULL));
|
||||||
if (element == NULL)
|
if (G_UNLIKELY (element == NULL))
|
||||||
goto no_element;
|
goto no_element;
|
||||||
|
|
||||||
/* fill in the pointer to the factory in the element class. The
|
/* fill in the pointer to the factory in the element class. The
|
||||||
* class will not be unreffed currently. */
|
* class will not be unreffed currently.
|
||||||
|
* FIXME: This isn't safe and may leak a refcount on the factory if 2 threads
|
||||||
|
* create the first instance of an element at the same moment */
|
||||||
oclass = GST_ELEMENT_GET_CLASS (element);
|
oclass = GST_ELEMENT_GET_CLASS (element);
|
||||||
if (oclass->elementfactory == NULL)
|
if (G_UNLIKELY (oclass->elementfactory == NULL))
|
||||||
oclass->elementfactory = factory;
|
oclass->elementfactory = factory;
|
||||||
|
else
|
||||||
|
gst_object_unref (factory);
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
gst_object_set_name (GST_OBJECT (element), name);
|
gst_object_set_name (GST_OBJECT (element), name);
|
||||||
|
@ -404,11 +408,13 @@ load_failed:
|
||||||
no_type:
|
no_type:
|
||||||
{
|
{
|
||||||
GST_WARNING_OBJECT (factory, "factory has no type");
|
GST_WARNING_OBJECT (factory, "factory has no type");
|
||||||
|
gst_object_unref (factory);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
no_element:
|
no_element:
|
||||||
{
|
{
|
||||||
GST_WARNING_OBJECT (factory, "could not create element");
|
GST_WARNING_OBJECT (factory, "could not create element");
|
||||||
|
gst_object_unref (factory);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ gst_plugin_feature_load (GstPluginFeature * feature)
|
||||||
GST_DEBUG ("loading plugin for feature %p; '%s'", feature,
|
GST_DEBUG ("loading plugin for feature %p; '%s'", feature,
|
||||||
GST_PLUGIN_FEATURE_NAME (feature));
|
GST_PLUGIN_FEATURE_NAME (feature));
|
||||||
if (feature->loaded)
|
if (feature->loaded)
|
||||||
return feature;
|
return gst_object_ref (feature);
|
||||||
|
|
||||||
GST_DEBUG ("loading plugin %s", feature->plugin_name);
|
GST_DEBUG ("loading plugin %s", feature->plugin_name);
|
||||||
plugin = gst_plugin_load_by_name (feature->plugin_name);
|
plugin = gst_plugin_load_by_name (feature->plugin_name);
|
||||||
|
|
|
@ -241,5 +241,6 @@ gst_type_find_factory_call_function (GstTypeFindFactory * factory,
|
||||||
g_assert (new_factory->function != NULL);
|
g_assert (new_factory->function != NULL);
|
||||||
|
|
||||||
new_factory->function (find, new_factory->user_data);
|
new_factory->function (find, new_factory->user_data);
|
||||||
|
gst_object_unref (new_factory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1097,6 +1097,7 @@ print_element_info (GstElementFactory * factory, gboolean print_names)
|
||||||
print_signal_info (element);
|
print_signal_info (element);
|
||||||
print_children_info (element);
|
print_children_info (element);
|
||||||
|
|
||||||
|
gst_object_unref (factory);
|
||||||
if (_name[0] != '\0')
|
if (_name[0] != '\0')
|
||||||
g_free (_name);
|
g_free (_name);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue