scenario: Use a weak ref to the pipeline

We are listening to it, we should not be owning a ref to it.
This commit is contained in:
Thibault Saunier 2013-10-05 12:01:46 -03:00
parent 7e1249f089
commit 4cea878563

View file

@ -679,6 +679,17 @@ message_cb (GstBus * bus, GstMessage * message,
return TRUE;
}
static void
_pipeline_freed_cb (GstValidateScenario * scenario, GObject * where_the_object_was)
{
GstValidateScenarioPrivate *priv = scenario->priv;
g_source_remove (priv->get_pos_id);
priv->pipeline = NULL;
GST_DEBUG_OBJECT (scenario, "pipeline was freed");
}
static gboolean
_load_scenario_file (GstValidateScenario * scenario,
const gchar * scenario_file)
@ -933,7 +944,9 @@ gst_validate_scenario_factory_create (GstValidateRunner * runner,
return NULL;
}
scenario->priv->pipeline = gst_object_ref (pipeline);
scenario->priv->pipeline = pipeline;
g_object_weak_ref (G_OBJECT (pipeline),
(GWeakNotify) _pipeline_freed_cb, scenario);
gst_validate_reporter_set_name (GST_VALIDATE_REPORTER (scenario),
g_strdup (scenario_name));