mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 03:29:50 +00:00
clip: Avoid list corruption when grouping objects
We are currently iterating over a list that is modified in the same method, we have to get a copy of the list, and iterate over the copy.
This commit is contained in:
parent
12eebdabda
commit
89e2a69d37
1 changed files with 3 additions and 5 deletions
|
@ -546,20 +546,18 @@ _group (GList * containers)
|
|||
supported_formats = GES_CLIP (ret)->priv->supportedformats;
|
||||
for (tmpclip = containers->next; tmpclip; tmpclip = tmpclip->next) {
|
||||
GESClip *cclip = tmpclip->data;
|
||||
GList *children = ges_container_get_children (GES_CONTAINER (cclip));
|
||||
|
||||
for (tmpelement = GES_CONTAINER_CHILDREN (cclip); tmpelement;
|
||||
tmpelement = tmpelement->next) {
|
||||
for (tmpelement = children; tmpelement; tmpelement = tmpelement->next) {
|
||||
GESTimelineElement *celement = GES_TIMELINE_ELEMENT (tmpelement->data);
|
||||
|
||||
/* We need to bump the refcount to avoid the object to be destroyed */
|
||||
gst_object_ref (celement);
|
||||
ges_container_remove (GES_CONTAINER (cclip), celement);
|
||||
ges_container_add (ret, celement);
|
||||
gst_object_unref (celement);
|
||||
|
||||
supported_formats = supported_formats |
|
||||
ges_track_element_get_track_type (GES_TRACK_ELEMENT (celement));
|
||||
}
|
||||
g_list_free_full (children, gst_object_unref);
|
||||
|
||||
ges_layer_remove_clip (layer, tmpclip->data);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue