Slighly take a different approach for object destruction, using the real _remove functions so that the scheduler has ...

Original commit message from CVS:
Slighly take a different approach for object destruction, using the real
_remove functions so that the scheduler has a chance to destroy its state
too.
This breaks the thread with ghostpads destruction case for now.
This commit is contained in:
Wim Taymans 2001-05-16 22:08:40 +00:00
parent 07aeaa83d5
commit d374791e8b
3 changed files with 21 additions and 15 deletions

View file

@ -498,20 +498,23 @@ static void
gst_bin_real_destroy (GtkObject *object) gst_bin_real_destroy (GtkObject *object)
{ {
GstBin *bin = GST_BIN (object); GstBin *bin = GST_BIN (object);
GList *children; GList *children, *orig;
GstElement *child; GstElement *child;
GST_DEBUG (GST_CAT_REFCOUNTING,"destroy()\n"); GST_DEBUG (GST_CAT_REFCOUNTING,"destroy()\n");
children = bin->children; if (bin->children) {
orig = children = g_list_copy (bin->children);
while (children) { while (children) {
child = GST_ELEMENT (children->data); child = GST_ELEMENT (children->data);
//gst_object_unref (GST_OBJECT (child)); //gst_object_unref (GST_OBJECT (child));
gst_object_unparent (GST_OBJECT (child)); //gst_object_unparent (GST_OBJECT (child));
gst_bin_remove (bin, child);
children = g_list_next (children); children = g_list_next (children);
} }
g_list_free (orig);
g_list_free (bin->children); g_list_free (bin->children);
}
bin->children = NULL; bin->children = NULL;
bin->numchildren = 0; bin->numchildren = 0;

View file

@ -909,14 +909,17 @@ gst_element_real_destroy (GtkObject *object)
orig = pads = g_list_copy (element->pads); orig = pads = g_list_copy (element->pads);
while (pads) { while (pads) {
pad = GST_PAD (pads->data); pad = GST_PAD (pads->data);
gst_object_destroy (GST_OBJECT (pad)); //gst_object_destroy (GST_OBJECT (pad));
gst_object_ref (GST_OBJECT (pad));
gst_element_remove_pad (element, pad);
gst_object_unref (GST_OBJECT (pad));
pads = g_list_next (pads); pads = g_list_next (pads);
} }
g_list_free (orig); g_list_free (orig);
}
g_list_free (element->pads); g_list_free (element->pads);
element->pads = NULL; element->pads = NULL;
}
element->numsrcpads = 0; element->numsrcpads = 0;
element->numsinkpads = 0; element->numsinkpads = 0;

View file

@ -160,11 +160,11 @@ gst_thread_real_destroy (GtkObject *gtk_object)
g_mutex_free (thread->lock); g_mutex_free (thread->lock);
g_cond_free (thread->cond); g_cond_free (thread->cond);
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) if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (gtk_object); GTK_OBJECT_CLASS (parent_class)->destroy (gtk_object);
gst_object_destroy (GST_OBJECT (GST_ELEMENT_SCHED (thread)));
gst_object_unref (GST_OBJECT (GST_ELEMENT_SCHED (thread)));
} }
static void static void