iterator: Add new FIXME for 0.11 and update gst_iterator_find_custom docs
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Sun, 13 Jun 2010 13:25:24 +0000 (15:25 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Sun, 13 Jun 2010 13:25:24 +0000 (15:25 +0200)
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

index 43d9b3f..d95a4b5 100644 (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.
  *