From cc490854b54a6cfcf0088fe85209bc7326f0604c Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Fri, 3 Jul 2020 17:01:18 -0400 Subject: [PATCH] pipeline: Remove urisink from timeline instead of unrefing it Doing what was suggested in the FIXME and avoiding to unref something it while we do not actually own it ourself. Part-of: --- ges/ges-pipeline.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ges/ges-pipeline.c b/ges/ges-pipeline.c index 09d89c67a0..3c8887bcfe 100644 --- a/ges/ges-pipeline.c +++ b/ges/ges-pipeline.c @@ -1140,11 +1140,13 @@ ges_pipeline_set_render_settings (GESPipeline * pipeline, } /* Clear previous URI sink if it existed */ - /* FIXME : We should figure out if it was added to the pipeline, - * and if so, remove it. */ if (pipeline->priv->urisink) { - gst_object_unref (pipeline->priv->urisink); + GstObject *sink_parent = + gst_object_get_parent (GST_OBJECT (pipeline->priv->urisink)); + if (sink_parent == GST_OBJECT (pipeline)) + gst_bin_remove (GST_BIN (pipeline), pipeline->priv->urisink); pipeline->priv->urisink = NULL; + gst_clear_object (&sink_parent); } pipeline->priv->urisink = @@ -1171,7 +1173,7 @@ ges_pipeline_set_render_settings (GESPipeline * pipeline, return FALSE; } - /* We got a referencer when getting back the profile */ + /* We got a reference when getting back the profile */ pipeline->priv->profile = profile; return TRUE;