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.
This commit is contained in:
Sebastian Dröge 2010-06-13 15:25:24 +02:00
parent c4ccbe093e
commit 18f23bc0b0

View file

@ -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.
*