GESTimeline: release timeline objects when a layer is removed

This commit is contained in:
Brandon Lewis 2010-10-07 12:29:05 +01:00 committed by Edward Hervey
parent 293cc5c6ca
commit f521d31b40

View file

@ -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);