More refcounting fixes

Original commit message from CVS:
More refcounting fixes
This commit is contained in:
Wim Taymans 2003-01-17 20:02:27 +00:00
parent eadfe716a0
commit acf7e665f3
2 changed files with 22 additions and 2 deletions

View file

@ -200,6 +200,7 @@ void
gst_object_unref (GstObject *object) gst_object_unref (GstObject *object)
{ {
g_return_if_fail (GST_IS_OBJECT (object)); g_return_if_fail (GST_IS_OBJECT (object));
g_return_if_fail (G_OBJECT (object)->ref_count > 0);
GST_DEBUG (GST_CAT_REFCOUNTING, "unref %p '%s' %d->%d", object, GST_DEBUG (GST_CAT_REFCOUNTING, "unref %p '%s' %d->%d", object,
GST_OBJECT_NAME (object), GST_OBJECT_NAME (object),

View file

@ -89,6 +89,13 @@ gst_scheduler_dispose (GObject *object)
{ {
GstScheduler *sched = GST_SCHEDULER (object); GstScheduler *sched = GST_SCHEDULER (object);
/* thse lists should all be NULL */
GST_DEBUG (0, "scheduler %p dispose %p %p %p",
object,
sched->clock_providers,
sched->clock_receivers,
sched->schedulers);
gst_object_swap ((GstObject **)&sched->current_clock, NULL); gst_object_swap ((GstObject **)&sched->current_clock, NULL);
gst_object_swap ((GstObject **)&sched->clock, NULL); gst_object_swap ((GstObject **)&sched->clock, NULL);
@ -378,6 +385,12 @@ gst_scheduler_add_scheduler (GstScheduler *sched, GstScheduler *sched2)
g_return_if_fail (GST_IS_SCHEDULER (sched)); g_return_if_fail (GST_IS_SCHEDULER (sched));
g_return_if_fail (GST_IS_SCHEDULER (sched2)); g_return_if_fail (GST_IS_SCHEDULER (sched2));
g_return_if_fail (sched2->parent_sched == NULL);
GST_DEBUG (0,"gstscheduler: %p add scheduler %p", sched, sched2);
gst_object_ref (GST_OBJECT (sched2));
gst_object_ref (GST_OBJECT (sched));
sched->schedulers = g_list_prepend (sched->schedulers, sched2); sched->schedulers = g_list_prepend (sched->schedulers, sched2);
sched2->parent_sched = sched; sched2->parent_sched = sched;
@ -402,14 +415,20 @@ gst_scheduler_remove_scheduler (GstScheduler *sched, GstScheduler *sched2)
g_return_if_fail (GST_IS_SCHEDULER (sched)); g_return_if_fail (GST_IS_SCHEDULER (sched));
g_return_if_fail (GST_IS_SCHEDULER (sched2)); g_return_if_fail (GST_IS_SCHEDULER (sched2));
g_return_if_fail (sched2->parent_sched == sched);
sched->schedulers = g_list_remove (sched->schedulers, sched2); GST_DEBUG (0,"gstscheduler: %p remove scheduler %p", sched, sched2);
sched2->parent_sched = NULL;
sclass = GST_SCHEDULER_GET_CLASS (sched); sclass = GST_SCHEDULER_GET_CLASS (sched);
if (sclass->remove_scheduler) if (sclass->remove_scheduler)
sclass->remove_scheduler (sched, sched2); sclass->remove_scheduler (sched, sched2);
sched->schedulers = g_list_remove (sched->schedulers, sched2);
sched2->parent_sched = NULL;
gst_object_unref (GST_OBJECT (sched2));
gst_object_unref (GST_OBJECT (sched));
} }
/** /**