mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
gst/gstelementfactory.c: Unref the factory after it was used the last time, not before.
Original commit message from CVS: * gst/gstelementfactory.c: (gst_element_factory_make): Unref the factory after it was used the last time, not before. * gst/gstindexfactory.c: (gst_index_factory_make): Improve debugging a bit and don't leak a ref to the index factory with each call.
This commit is contained in:
parent
4b87b40779
commit
763e6a7d89
3 changed files with 33 additions and 3 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2008-04-23 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
|
|
||||||
|
* gst/gstelementfactory.c: (gst_element_factory_make):
|
||||||
|
Unref the factory after it was used the last time, not before.
|
||||||
|
|
||||||
|
* gst/gstindexfactory.c: (gst_index_factory_make):
|
||||||
|
Improve debugging a bit and don't leak a ref to the index factory with
|
||||||
|
each call.
|
||||||
|
|
||||||
2008-04-23 Stefan Kost <ensonic@users.sf.net>
|
2008-04-23 Stefan Kost <ensonic@users.sf.net>
|
||||||
|
|
||||||
* gst/gstregistry.c:
|
* gst/gstregistry.c:
|
||||||
|
|
|
@ -472,10 +472,10 @@ gst_element_factory_make (const gchar * factoryname, const gchar * name)
|
||||||
|
|
||||||
GST_LOG_OBJECT (factory, "found factory %p", factory);
|
GST_LOG_OBJECT (factory, "found factory %p", factory);
|
||||||
element = gst_element_factory_create (factory, name);
|
element = gst_element_factory_create (factory, name);
|
||||||
gst_object_unref (factory);
|
|
||||||
if (element == NULL)
|
if (element == NULL)
|
||||||
goto create_failed;
|
goto create_failed;
|
||||||
|
|
||||||
|
gst_object_unref (factory);
|
||||||
return element;
|
return element;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
@ -487,6 +487,7 @@ no_factory:
|
||||||
create_failed:
|
create_failed:
|
||||||
{
|
{
|
||||||
GST_INFO_OBJECT (factory, "couldn't create instance!");
|
GST_INFO_OBJECT (factory, "couldn't create instance!");
|
||||||
|
gst_object_unref (factory);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,13 +205,33 @@ GstIndex *
|
||||||
gst_index_factory_make (const gchar * name)
|
gst_index_factory_make (const gchar * name)
|
||||||
{
|
{
|
||||||
GstIndexFactory *factory;
|
GstIndexFactory *factory;
|
||||||
|
GstIndex *index;
|
||||||
|
|
||||||
g_return_val_if_fail (name != NULL, NULL);
|
g_return_val_if_fail (name != NULL, NULL);
|
||||||
|
|
||||||
factory = gst_index_factory_find (name);
|
factory = gst_index_factory_find (name);
|
||||||
|
|
||||||
if (factory == NULL)
|
if (factory == NULL)
|
||||||
return NULL;
|
goto no_factory;
|
||||||
|
|
||||||
return gst_index_factory_create (factory);
|
index = gst_index_factory_create (factory);
|
||||||
|
|
||||||
|
if (index == NULL)
|
||||||
|
goto create_failed;
|
||||||
|
|
||||||
|
gst_object_unref (factory);
|
||||||
|
return index;
|
||||||
|
|
||||||
|
/* ERRORS */
|
||||||
|
no_factory:
|
||||||
|
{
|
||||||
|
GST_INFO ("no such index factory \"%s\"!", name);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
create_failed:
|
||||||
|
{
|
||||||
|
GST_INFO_OBJECT (factory, "couldn't create instance!");
|
||||||
|
gst_object_unref (factory);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue