From 18f23bc0b0b65b4648e3b375947ccfbb98f5c645 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 13 Jun 2010 15:25:24 +0200 Subject: [PATCH] iterator: Add new FIXME for 0.11 and update gst_iterator_find_custom docs The compare function should only unref the element if it's not the matching element. Also the FIXME in _fold() is not relevant because the ref/unref happens in the fold function. --- gst/gstiterator.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gst/gstiterator.c b/gst/gstiterator.c index 43d9b3f..d95a4b5 100644 --- a/gst/gstiterator.c +++ b/gst/gstiterator.c @@ -546,7 +546,6 @@ gst_iterator_fold (GstIterator * it, GstIteratorFoldFunction func, result = gst_iterator_next (it, &item); switch (result) { case GST_ITERATOR_OK: - /* FIXME: is there a way to ref/unref items? */ if (!func (item, ret, user_data)) goto fold_done; else @@ -621,6 +620,13 @@ find_custom_fold_func (gpointer item, GValue * ret, FindCustomFoldData * data) } } +/* FIXME 0.11: + * We should store ref/unref (or copy/free) functions for the type + * in GstIterator. The unref but only if it's not a match behaviour + * of find_custom() is very bad for bindings. The ref/unref functions + * are also useful for the fold and filter cases. + */ + /** * gst_iterator_find_custom: * @it: The #GstIterator to iterate @@ -630,7 +636,8 @@ find_custom_fold_func (gpointer item, GValue * ret, FindCustomFoldData * data) * Find the first element in @it that matches the compare function @func. * @func should return 0 when the element is found. As in gst_iterator_fold(), * the refcount of a refcounted object will be increased before @func is - * called, and should be unrefed after use. + * called, and should be unrefed after use in @func unless it is the matching + * element. * * The iterator will not be freed. * -- 2.7.4