gst/: Fix memory leak in GstTypeFindFactory.

Original commit message from CVS:
* gst/gsttypefind.c: (gst_type_find_register):
* gst/gsttypefind.h:
* gst/gsttypefindfactory.c: (gst_type_find_factory_init),
(gst_type_find_factory_dispose):
* gst/gsttypefindfactory.h:
Fix memory leak in GstTypeFindFactory.
This commit is contained in:
Edward Hervey 2005-11-29 23:56:20 +00:00
parent 4e54207b0a
commit 0db5df88fc
6 changed files with 22 additions and 3 deletions

View file

@ -1,3 +1,12 @@
2005-11-30 Edward Hervey <edward@fluendo.com>
* gst/gsttypefind.c: (gst_type_find_register):
* gst/gsttypefind.h:
* gst/gsttypefindfactory.c: (gst_type_find_factory_init),
(gst_type_find_factory_dispose):
* gst/gsttypefindfactory.h:
Fix memory leak in GstTypeFindFactory.
2005-11-29 Thomas Vander Stichele <thomas (at) apestaart (dot) org>
* gst/gst.c:

2
common

@ -1 +1 @@
Subproject commit 33084fbe0531733bc02aa1d9de608206d5553a15
Subproject commit 8db4c613eb1aa57dc21d25a4b83b36e3cdedc5ca

View file

@ -48,6 +48,8 @@ GST_DEBUG_CATEGORY_EXTERN (gst_type_find_debug);
* @possible_caps: Optionally the caps that could be returned when typefinding succeeds
* @data: Optional user data. This user data must be available until the plugin
* is unloaded.
* @data_notify: a #GDestroyNotify that will be called on @data when the plugin
* is unloaded.
*
* Registers a new typefind function to be used for typefinding. After
* registering this function will be available for typefinding.
@ -58,7 +60,7 @@ GST_DEBUG_CATEGORY_EXTERN (gst_type_find_debug);
gboolean
gst_type_find_register (GstPlugin * plugin, const gchar * name, guint rank,
GstTypeFindFunction func, gchar ** extensions,
const GstCaps * possible_caps, gpointer data)
const GstCaps * possible_caps, gpointer data, GDestroyNotify data_notify)
{
GstTypeFindFactory *factory;
@ -81,6 +83,7 @@ gst_type_find_register (GstPlugin * plugin, const gchar * name, guint rank,
gst_caps_replace (&factory->caps, (GstCaps *) possible_caps);
factory->function = func;
factory->user_data = data;
factory->user_data_notify = data_notify;
GST_PLUGIN_FEATURE (factory)->plugin_name = g_strdup (plugin->desc.name);
GST_PLUGIN_FEATURE (factory)->loaded = TRUE;

View file

@ -102,7 +102,8 @@ gboolean gst_type_find_register (GstPlugin * plugin,
GstTypeFindFunction func,
gchar ** extensions,
const GstCaps * possible_caps,
gpointer data);
gpointer data,
GDestroyNotify data_notify);
G_END_DECLS

View file

@ -141,6 +141,7 @@ gst_type_find_factory_init (GTypeInstance * instance, gpointer g_class)
GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (instance);
factory->user_data = factory;
factory->user_data_notify = NULL;
}
static void
@ -156,6 +157,10 @@ gst_type_find_factory_dispose (GObject * object)
g_strfreev (factory->extensions);
factory->extensions = NULL;
}
if (factory->user_data_notify && factory->user_data) {
factory->user_data_notify (factory->user_data);
factory->user_data = NULL;
}
}
/**

View file

@ -53,6 +53,7 @@ struct _GstTypeFindFactory {
GstCaps * caps; /* FIXME: not yet saved in registry */
gpointer user_data;
GDestroyNotify user_data_notify;
gpointer _gst_reserved[GST_PADDING];
};