From b30c7d370ef2f3fa121c62fc17ceed8ae2e32149 Mon Sep 17 00:00:00 2001 From: Sebastian Dröge Date: Fri, 19 Feb 2010 13:26:01 +0100 Subject: interpolationcontrolsource: Don't pass NULL pointers to GSequence API This causes assertion failures. Fixes bug #610444. --- libs/gst/controller/gstinterpolationcontrolsource.c | 2 +- tests/check/libs/controller.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libs/gst/controller/gstinterpolationcontrolsource.c b/libs/gst/controller/gstinterpolationcontrolsource.c index 397ae4f9c..1c7436bec 100644 --- a/libs/gst/controller/gstinterpolationcontrolsource.c +++ b/libs/gst/controller/gstinterpolationcontrolsource.c @@ -562,7 +562,7 @@ gst_interpolation_control_source_unset (GstInterpolationControlSource * self, g_mutex_lock (self->lock); /* check if a control point for the timestamp exists */ - if ((iter = + if (G_LIKELY (self->priv->values) && (iter = g_sequence_search (self->priv->values, ×tamp, (GCompareDataFunc) gst_control_point_find, NULL))) { GstControlPoint *cp; diff --git a/tests/check/libs/controller.c b/tests/check/libs/controller.c index e3568a437..c254dfcdc 100644 --- a/tests/check/libs/controller.c +++ b/tests/check/libs/controller.c @@ -950,14 +950,22 @@ GST_START_TEST (controller_interpolation_unset) res = gst_interpolation_control_source_unset (csource, 1 * GST_SECOND); fail_unless (res, NULL); - g_object_unref (csource); - /* verify value again */ gst_controller_sync_values (ctrl, 1 * GST_SECOND); fail_unless_equals_int (GST_TEST_MONO_SOURCE (elem)->val_ulong, 0); gst_controller_sync_values (ctrl, 2 * GST_SECOND); 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); g_object_unref (ctrl); gst_object_unref (elem); -- cgit v1.2.3