mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
iterator: only unset GValue if it was inited
And add some function guards. From GLib 2.48 on it is allowed to pass an uninitialised GValue to g_value_unset(). https://bugzilla.gnome.org/show_bug.cgi?id=763762
This commit is contained in:
parent
1c8711816e
commit
e0de5ed915
1 changed files with 8 additions and 0 deletions
|
@ -607,6 +607,8 @@ gst_iterator_fold (GstIterator * it, GstIteratorFoldFunction func,
|
||||||
GValue item = { 0, };
|
GValue item = { 0, };
|
||||||
GstIteratorResult result;
|
GstIteratorResult result;
|
||||||
|
|
||||||
|
g_return_val_if_fail (it != NULL, GST_ITERATOR_ERROR);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
result = gst_iterator_next (it, &item);
|
result = gst_iterator_next (it, &item);
|
||||||
switch (result) {
|
switch (result) {
|
||||||
|
@ -625,7 +627,13 @@ gst_iterator_fold (GstIterator * it, GstIteratorFoldFunction func,
|
||||||
}
|
}
|
||||||
|
|
||||||
fold_done:
|
fold_done:
|
||||||
|
|
||||||
|
#if GLIB_CHECK_VERSION (2, 48, 0)
|
||||||
g_value_unset (&item);
|
g_value_unset (&item);
|
||||||
|
#else
|
||||||
|
if (item.g_type != 0)
|
||||||
|
g_value_unset (&item);
|
||||||
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue