From: Sebastian Dröge Date: Sun, 13 Jun 2010 13:25:24 +0000 (+0200) Subject: iterator: Add new FIXME for 0.11 and update gst_iterator_find_custom docs X-Git-Tag: RELEASE-0.10.30~122 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=18f23bc0b0b65b4648e3b375947ccfbb98f5c645;p=platform%2Fupstream%2Fgstreamer.git 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. --- 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. *