Fixed a leak in bin destruction

Original commit message from CVS:
Fixed a leak in bin destruction
More refcounting fixes
This commit is contained in:
Wim Taymans 2001-05-12 18:04:20 +00:00
parent 12cfd1842c
commit 6f9ac3667b
5 changed files with 11 additions and 5 deletions

View file

@ -500,16 +500,20 @@ gst_bin_real_destroy (GtkObject *object)
GList *children;
GstElement *child;
GST_DEBUG (0,"in gst_bin_real_destroy()\n");
GST_DEBUG (GST_CAT_REFCOUNTING,"destroy()\n");
children = bin->children;
while (children) {
child = GST_ELEMENT (children->data);
gst_element_destroy (child);
gst_object_unref (GST_OBJECT (child));
children = g_list_next (children);
}
g_list_free (bin->children);
bin->children = NULL;
bin->numchildren = 0;
g_cond_free (bin->eoscond);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);

View file

@ -894,6 +894,9 @@ gst_element_real_destroy (GtkObject *object)
}
g_list_free (element->pads);
element->pads = NULL;
element->numsrcpads = 0;
element->numsinkpads = 0;
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);

View file

@ -161,7 +161,6 @@ gst_elementfactory_create (GstElementFactory *factory,
// create an instance of the element
element = GST_ELEMENT(gtk_type_new(factory->type));
g_assert(element != NULL);
gst_object_ref(GST_OBJECT(element));
// attempt to set the elemenfactory class pointer if necessary
oclass = GST_ELEMENT_CLASS(GTK_OBJECT(element)->klass);

View file

@ -200,7 +200,7 @@ gst_thread_get_arg (GtkObject *object,
* Returns: The new thread
*/
GstElement*
gst_thread_new (guchar *name)
gst_thread_new (const guchar *name)
{
return gst_elementfactory_make ("thread", name);
}

View file

@ -79,7 +79,7 @@ struct _GstThreadClass {
GtkType gst_thread_get_type (void);
GstElement* gst_thread_new (guchar *name);
GstElement* gst_thread_new (const guchar *name);
#ifdef __cplusplus
}