Added ghostpad destruction.

Original commit message from CVS:
Added ghostpad destruction.
This commit is contained in:
Wim Taymans 2001-05-15 19:25:31 +00:00
parent 05a517acf1
commit cff4720acf
3 changed files with 19 additions and 4 deletions

View file

@ -254,6 +254,7 @@ gst_object_finalize (GtkObject *gtk_object)
object = GST_OBJECT (gtk_object);
GST_DEBUG (GST_CAT_REFCOUNTING, "finalize '%s'\n",GST_OBJECT_NAME(object));
if (object->name != NULL)
g_free (object->name);

View file

@ -1035,7 +1035,22 @@ gst_real_pad_destroy (GtkObject *object)
gst_element_remove_pad (GST_ELEMENT (GST_OBJECT_PARENT (pad)), pad);
// FIXME we should destroy the ghostpads, because they are nothing without the real pad
g_list_free (GST_REAL_PAD(pad)->ghostpads);
if (GST_REAL_PAD (pad)->ghostpads) {
GList *orig, *ghostpads;
orig = ghostpads = g_list_copy (GST_REAL_PAD (pad)->ghostpads);
while (ghostpads) {
GstPad *ghostpad = GST_PAD (ghostpads->data);
if (GST_IS_ELEMENT (GST_OBJECT_PARENT (ghostpad)))
gst_element_remove_pad (GST_ELEMENT (GST_OBJECT_PARENT (ghostpad)), ghostpad);
ghostpads = g_list_next (ghostpads);
}
g_list_free (orig);
g_list_free (GST_REAL_PAD(pad)->ghostpads);
}
if (GTK_OBJECT_CLASS (real_pad_parent_class)->destroy)
GTK_OBJECT_CLASS (real_pad_parent_class)->destroy (object);

View file

@ -142,7 +142,6 @@ gst_thread_init (GstThread *thread)
GST_FLAG_SET (thread, GST_THREAD_CREATE);
thread->lock = g_mutex_new();
thread->cond = g_cond_new();
GST_ELEMENT_SCHED(thread) = gst_schedule_new(GST_ELEMENT(thread));
@ -161,8 +160,8 @@ gst_thread_real_destroy (GtkObject *gtk_object)
g_mutex_free (thread->lock);
g_cond_free (thread->cond);
gst_object_destroy (GST_ELEMENT_SCHED(thread));
gst_object_unref (GST_ELEMENT_SCHED(thread));
gst_object_destroy (GST_OBJECT (GST_ELEMENT_SCHED (thread)));
gst_object_unref (GST_OBJECT (GST_ELEMENT_SCHED (thread)));
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (gtk_object);