Commit 8f468881 authored by Thibault Saunier's avatar Thibault Saunier 🌵

ges: Always check return value of `ges_container_add`

Making coverity happy

CIDs: 1461460, 1461461, 1461462, 1461463, 1461464, 1461465, 1461466, 1461468,
parent 5fd0943c
......@@ -480,7 +480,11 @@ _add_all_groups (GESFormatter * self)
GST_DEBUG_OBJECT (tmp->data, "Adding %s child %" GST_PTR_FORMAT " %s",
(const gchar *) lchild->data, child,
GES_TIMELINE_ELEMENT_NAME (child));
ges_container_add (GES_CONTAINER (pgroup->group), child);
if (!ges_container_add (GES_CONTAINER (pgroup->group), child)) {
GST_ERROR ("%" GES_FORMAT " could not add child %p while"
" reloading, this should never happen", GES_ARGS (pgroup->group),
child);
}
}
pgroup->group = NULL;
}
......@@ -624,7 +628,10 @@ _add_track_element (GESFormatter * self, GESClip * clip,
GST_DEBUG_OBJECT (self, "Adding track_element: %" GST_PTR_FORMAT
" To : %" GST_PTR_FORMAT, trackelement, clip);
ges_container_add (GES_CONTAINER (clip), GES_TIMELINE_ELEMENT (trackelement));
if (!ges_container_add (GES_CONTAINER (clip),
GES_TIMELINE_ELEMENT (trackelement)))
GST_ERROR ("%" GES_FORMAT " could not add child %p while"
" reloading, this should never happen", GES_ARGS (clip), trackelement);
gst_structure_foreach (children_properties,
(GstStructureForeachFunc) _set_child_property, trackelement);
......
......@@ -872,7 +872,10 @@ _transfer_child (GESClip * from_clip, GESClip * to_clip,
GES_TIMELINE_ELEMENT (child));
to_clip->priv->allow_any_track = TRUE;
ges_container_add (GES_CONTAINER (to_clip), GES_TIMELINE_ELEMENT (child));
if (!ges_container_add (GES_CONTAINER (to_clip),
GES_TIMELINE_ELEMENT (child)))
GST_ERROR ("%" GES_FORMAT " could not add child %p while"
" transfering, this should never happen", GES_ARGS (to_clip), child);
to_clip->priv->allow_any_track = FALSE;
ges_timeline_set_moving_track_elements (timeline, FALSE);
......
......@@ -383,7 +383,9 @@ _paste (GESTimelineElement * element, GESTimelineElement * ref,
}
/* for GESGroups, this may register the group on the timeline */
ges_container_add (ncontainer, nchild);
if (!ges_container_add (ncontainer, nchild))
GST_ERROR ("%" GES_FORMAT " could not add child %p while"
" copying, this should never happen", GES_ARGS (ncontainer), nchild);
}
return GES_TIMELINE_ELEMENT (ncontainer);
......
......@@ -677,7 +677,13 @@ _group (GList * containers)
return NULL;
}
ges_container_add (ret, tmp->data);
if (!ges_container_add (ret, tmp->data)) {
GST_INFO ("%" GES_FORMAT " could not add child %p while"
" grouping", GES_ARGS (ret), tmp->data);
g_object_unref (ret);
return NULL;
}
}
/* No need to add to the timeline here, this will be done in _child_added */
......
......@@ -541,7 +541,10 @@ make_source (GESFormatter * self, GList * reflist, GHashTable * source_table)
effect_table =
g_hash_table_lookup (props_table, (gchar *) "effect_props");
ges_container_add (GES_CONTAINER (src), GES_TIMELINE_ELEMENT (effect));
if (!ges_container_add (GES_CONTAINER (src),
GES_TIMELINE_ELEMENT (effect)))
GST_ERROR ("%" GES_FORMAT " could not add %p while"
" reloading, this should never happen", GES_ARGS (src), effect);
if (!g_strcmp0 (active, (gchar *) "(bool)False"))
ges_track_element_set_active (GES_TRACK_ELEMENT (effect), FALSE);
......
......@@ -364,8 +364,10 @@ ges_demux_adapt_timeline_duration (GESDemux * self, GESTimeline * timeline)
text = ges_effect_new (effect_str);
g_free (effect_str_full);
ges_container_add (GES_CONTAINER (clip),
GES_TIMELINE_ELEMENT (text));
if (!ges_container_add (GES_CONTAINER (clip),
GES_TIMELINE_ELEMENT (text))) {
GST_ERROR ("Could not add text overlay to ending clip!");
}
}
}
......
......@@ -1712,7 +1712,7 @@ GST_START_TEST (test_children_time_setters)
ges_track_element_set_has_internal_source (child, TRUE);
_test_children_time_setting_on_clip (clip, child);
/* clip in a group */
ges_container_add (group, GES_TIMELINE_ELEMENT (clip));
fail_unless (ges_container_add (group, GES_TIMELINE_ELEMENT (clip)));
_test_children_time_setting_on_clip (clip, child);
/* group is removed from the timeline and destroyed when empty */
ges_container_remove (group, GES_TIMELINE_ELEMENT (clip));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment