GNOME Bugzilla – Bug 395554
gst_tag_setter_merge_tags works at most once
Last modified: 2007-01-12 10:49:07 UTC
Fun question: What's wrong with this code from gst/gsttagsetter.c: void gst_tag_setter_merge_tags (GstTagSetter * setter, const GstTagList * list, GstTagMergeMode mode) { GstTagData *data; g_return_if_fail (GST_IS_TAG_SETTER (setter)); g_return_if_fail (GST_TAG_MODE_IS_VALID (mode)); data = gst_tag_setter_get_data (setter); if (!data->list) { data->list = gst_tag_list_copy (list); } else { gst_tag_list_merge (data->list, list, mode); } } Answer: gst_tag_list_merge merges the two lists that are passed to it and _returns_ the result as a new list. Note how the return value is ignored here. The solution is to use gst_tag_list_insert instead. Attaching trivial patch.
Created attachment 80066 [details] [review] Fix gst_tag_setter_merge_tags
2007-01-11 Tim-Philipp Müller <tim at centricular dot net> Patch by: René Stadler <mail at renestadler dot de> * gst/gsttagsetter.c: (gst_tag_setter_merge_tags): gst_tag_list_merge() returns a new list, so it's not the best idea to ingore its return value. Effectively meant that tags could only be merged on a GstTagSetter once using _merge_tags(). Fixes #395554. Also add function guard to require a non-NULL taglist as input (has always been so due to gst_tag_list_copy(), just making it explicit).