GNOME Bugzilla – Bug 459204
[PATCH] [playbin] gst_play_base_bin_get_streaminfo_value_array should not return NULL
Last modified: 2007-07-23 11:24:54 UTC
The python code that trigged the segfault was: elif t == gst.MESSAGE_STATE_CHANGED: old, new, pen = message.parse_state_changed() if old == gst.STATE_READY and (new == gst.STATE_PAUSED or new == gst.STATE_PLAYING): print self.player.props.stream_info_value_array The problem is that get_active_group() in the playbin returns NULL at some points. That causes array to be NULL, which causes the boxed value to be NULL, which causes pygobject to dereferences the returned value because it's expecting an array. Arguably pygobject should be more robust, but my look through the glib code looks like NULL shouldn't be passed to g_value_take_boxed() static GValueArray * gst_play_base_bin_get_streaminfo_value_array (GstPlayBaseBin * play_base_bin) { GstPlayBaseGroup *group; GValueArray *array = NULL; GROUP_LOCK (play_base_bin); group = get_active_group (play_base_bin); if (group) { array = g_value_array_copy (group->streaminfo_value_array); - } + } else { + array = g_value_array_new (0); + } GROUP_UNLOCK (play_base_bin); return array; } I don't think this will leak because the GValue takes ownership of the array anyway. Plus, it's a GValueArray, and an empty GValueArray is actually an allocated array with 0 elements, not a NULL.
Patch by: Dan Williams <dcbw at redhat dot com> * gst/playback/gstplaybasebin.c: (gst_play_base_bin_get_streaminfo_value_array): Don't return NULL when querying the stream info value array but instead return an empty array. Fixes #459204.