diff --git a/ges/ges-timeline.c b/ges/ges-timeline.c index 537bf1835e..ac4c2a940d 100644 --- a/ges/ges-timeline.c +++ b/ges/ges-timeline.c @@ -566,6 +566,8 @@ ges_timeline_add_layer (GESTimeline * timeline, GESTimelineLayer * layer) gboolean ges_timeline_remove_layer (GESTimeline * timeline, GESTimelineLayer * layer) { + GList *layer_objects, *tmp; + GST_DEBUG ("timeline:%p, layer:%p", timeline, layer); if (G_UNLIKELY (!g_list_find (timeline->layers, layer))) { @@ -573,6 +575,16 @@ ges_timeline_remove_layer (GESTimeline * timeline, GESTimelineLayer * layer) return FALSE; } + /* remove objects from any private data structures */ + + layer_objects = ges_timeline_layer_get_objects (layer); + for (tmp = layer_objects; tmp; tmp = tmp->next) { + layer_object_removed_cb (layer, GES_TIMELINE_OBJECT (tmp->data), timeline); + g_object_unref (G_OBJECT (tmp->data)); + tmp->data = NULL; + } + g_list_free (layer_objects); + /* Disconnect signals */ GST_DEBUG ("Disconnecting signal callbacks"); g_signal_handlers_disconnect_by_func (layer, layer_object_added_cb, timeline);