container: Call _remove_child when cannot set parent
authorAlexandru Băluț <alexandru.balut@gmail.com>
Thu, 11 Apr 2019 21:58:48 +0000 (23:58 +0200)
committerThibault Saunier <tsaunier@gnome.org>
Wed, 17 Apr 2019 21:56:21 +0000 (21:56 +0000)
ges_container_add removes the child being added if the call to
ges_timeline_element_set_parent fails. In this case, subclasses should
be given the chance to revert the effects of the add_child vmethod which
has just been called.

ges/ges-container.c

index 87a3abb..07a5afa 100644 (file)
@@ -776,6 +776,8 @@ ges_container_add (GESContainer * container, GESTimelineElement * child)
 
   if (ges_timeline_element_set_parent (child, GES_TIMELINE_ELEMENT (container))
       == FALSE) {
+    if (class->remove_child)
+      class->remove_child (container, child);
 
     g_hash_table_remove (priv->mappings, child);
     container->children = g_list_remove (container->children, child);