summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2010-02-19 13:26:01 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2010-02-19 14:31:54 +0100
commitb30c7d370ef2f3fa121c62fc17ceed8ae2e32149 (patch)
tree2ee710ab24e626be93a2bf702cbdefad37b75051
parent82f380704afcc4977fcf5e814e28a69f8e862ae5 (diff)
interpolationcontrolsource: Don't pass NULL pointers to GSequence API
This causes assertion failures. Fixes bug #610444.
-rw-r--r--libs/gst/controller/gstinterpolationcontrolsource.c2
-rw-r--r--tests/check/libs/controller.c12
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, &timestamp,
(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);