GNOME Bugzilla – Bug 681955
gst_discoverer_stream_info_list_free () causes a critical error
Last modified: 2012-08-16 00:21:35 UTC
I have the following function for processing : void infoprocess (GstDiscovererStreamInfo * info) { <non-disruptive code (only works with const data)> if (GST_IS_DISCOVERER_CONTAINER_INFO (info)) { GstDiscovererContainerInfo *c = GST_DISCOVERER_CONTAINER_INFO (info); GList *children = gst_discoverer_container_info_get_streams (c); if (children) { GstDiscovererStreamInfo *sinfo = children->data; while (NULL != sinfo) { GstDiscovererStreamInfo *next; infoprocess (sinfo); next = gst_discoverer_stream_info_get_next (sinfo); gst_discoverer_stream_info_unref (sinfo); sinfo = next; } gst_discoverer_stream_info_list_free (children); } } } On some files this code throws a critical error:
+ Trace 230681
Commenting out the gst_discoverer_stream_info_list_free (children); line fixes this. This might turn out to be just an issue with memory corruption though.
OK, figured it out. I have to ref the first children in the list returned by gst_discoverer_container_info_get_streams(), because while loop body unrefs each object in the list, and gst_discoverer_stream_info_list_free() ALSO unrefs each object on the list. Problem is that gst_discoverer_stream_info_get_next() is not called for the first object in the list, so refs/unrefs are unbalanced for it.