From 64bb85e6a1c81f808ad00108913888178885f356 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 22 Oct 2019 11:50:02 +0200 Subject: [PATCH] ges: Fix setting GError when adding children to containers We were misusing assertion and not properly setting the GError value --- ges/ges-structured-interface.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ges/ges-structured-interface.c b/ges/ges-structured-interface.c index 23d8dc9379..071333706b 100644 --- a/ges/ges-structured-interface.c +++ b/ges/ges-structured-interface.c @@ -552,7 +552,14 @@ _ges_container_add_child_from_struct (GESTimeline * timeline, GES_CONTAINER (ges_timeline_get_element (timeline, container_name)); } - g_return_val_if_fail (GES_IS_CONTAINER (container), FALSE); + if (!GES_IS_CONTAINER (container)) { + *error = + g_error_new (GES_ERROR, 0, "Could not find container: %s (%p)", + container_name, container); + + res = FALSE; + goto beach; + } id = gst_structure_get_string (structure, "asset-id"); child_type = gst_structure_get_string (structure, "child-type"); @@ -569,7 +576,7 @@ _ges_container_add_child_from_struct (GESTimeline * timeline, child = GES_TIMELINE_ELEMENT (ges_asset_extract (asset, NULL)); if (!GES_IS_TIMELINE_ELEMENT (child)) { - g_error_new (GES_ERROR, 0, "Could not extract child element"); + *error = g_error_new (GES_ERROR, 0, "Could not extract child element"); goto beach; } @@ -579,14 +586,15 @@ _ges_container_add_child_from_struct (GESTimeline * timeline, if (!child && child_name) { child = ges_timeline_get_element (timeline, child_name); if (!GES_IS_TIMELINE_ELEMENT (child)) { - g_error_new (GES_ERROR, 0, "Could not find child element"); + *error = g_error_new (GES_ERROR, 0, "Could not find child element"); goto beach; } } if (!child) { - g_error_new (GES_ERROR, 0, "Wrong parameters, could not get a child"); + *error = + g_error_new (GES_ERROR, 0, "Wrong parameters, could not get a child"); return FALSE; }