interpolationcontrolsource: Don't pass NULL pointers to GSequence API

This causes assertion failures. Fixes bug #610444.
This commit is contained in:
Sebastian Dröge 2010-02-19 13:26:01 +01:00
parent 82f380704a
commit b30c7d370e
2 changed files with 11 additions and 3 deletions

View file

@ -562,7 +562,7 @@ gst_interpolation_control_source_unset (GstInterpolationControlSource * self,
g_mutex_lock (self->lock); g_mutex_lock (self->lock);
/* check if a control point for the timestamp exists */ /* check if a control point for the timestamp exists */
if ((iter = if (G_LIKELY (self->priv->values) && (iter =
g_sequence_search (self->priv->values, &timestamp, g_sequence_search (self->priv->values, &timestamp,
(GCompareDataFunc) gst_control_point_find, NULL))) { (GCompareDataFunc) gst_control_point_find, NULL))) {
GstControlPoint *cp; GstControlPoint *cp;

View file

@ -950,14 +950,22 @@ GST_START_TEST (controller_interpolation_unset)
res = gst_interpolation_control_source_unset (csource, 1 * GST_SECOND); res = gst_interpolation_control_source_unset (csource, 1 * GST_SECOND);
fail_unless (res, NULL); fail_unless (res, NULL);
g_object_unref (csource);
/* verify value again */ /* verify value again */
gst_controller_sync_values (ctrl, 1 * GST_SECOND); gst_controller_sync_values (ctrl, 1 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0);
gst_controller_sync_values (ctrl, 2 * GST_SECOND); gst_controller_sync_values (ctrl, 2 * GST_SECOND);
fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50); fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 50);
/* unset all values, reset and try to unset again */
fail_unless (gst_interpolation_control_source_unset (csource,
0 * GST_SECOND));
fail_unless (gst_interpolation_control_source_unset (csource,
2 * GST_SECOND));
gst_interpolation_control_source_unset_all (csource);
fail_if (gst_interpolation_control_source_unset (csource, 2 * GST_SECOND));
g_object_unref (csource);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
g_object_unref (ctrl); g_object_unref (ctrl);
gst_object_unref (elem); gst_object_unref (elem);