mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
iterator: Allow to use NULL as object for the single iterator
This commit is contained in:
parent
b2cab40745
commit
a1ae8a3a3e
1 changed files with 4 additions and 4 deletions
|
@ -674,7 +674,7 @@ static GstIteratorResult
|
|||
gst_single_object_iterator_iterator_next (GstSingleObjectIterator * it,
|
||||
gpointer * result)
|
||||
{
|
||||
if (it->visited) {
|
||||
if (it->visited || !it->object) {
|
||||
*result = NULL;
|
||||
return GST_ITERATOR_DONE;
|
||||
}
|
||||
|
@ -692,6 +692,7 @@ gst_single_object_iterator_resync (GstSingleObjectIterator * it)
|
|||
static void
|
||||
gst_single_object_iterator_free (GstSingleObjectIterator * it)
|
||||
{
|
||||
if (it->object)
|
||||
it->free (it->object);
|
||||
g_free (it);
|
||||
}
|
||||
|
@ -717,7 +718,6 @@ gst_iterator_new_single (GType type, gpointer object, GstCopyFunction copy,
|
|||
{
|
||||
GstSingleObjectIterator *result;
|
||||
|
||||
g_return_val_if_fail (object != NULL, NULL);
|
||||
g_return_val_if_fail (copy != NULL, NULL);
|
||||
g_return_val_if_fail (free != NULL, NULL);
|
||||
|
||||
|
@ -728,7 +728,7 @@ gst_iterator_new_single (GType type, gpointer object, GstCopyFunction copy,
|
|||
(GstIteratorResyncFunction) gst_single_object_iterator_resync,
|
||||
(GstIteratorFreeFunction) gst_single_object_iterator_free);
|
||||
|
||||
result->object = copy (object);
|
||||
result->object = (object) ? copy (object) : NULL;
|
||||
result->copy = copy;
|
||||
result->free = free;
|
||||
result->visited = FALSE;
|
||||
|
|
Loading…
Reference in a new issue