From 683f827a8be94145a2e1c93622d3151169cd8b43 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Mon, 1 Apr 2019 11:52:43 -0300 Subject: [PATCH] xml-formatter: Free pending clips on disposal --- ges/ges-base-xml-formatter.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ges/ges-base-xml-formatter.c b/ges/ges-base-xml-formatter.c index 2f7b97a4ea..3bf81ae563 100644 --- a/ges/ges-base-xml-formatter.c +++ b/ges/ges-base-xml-formatter.c @@ -139,6 +139,9 @@ struct _GESBaseXmlFormatterPrivate GList *groups; }; +static void +_free_pending_clip (GESBaseXmlFormatterPrivate * priv, PendingClip * pend); + static void _free_layer_entry (LayerEntry * entry) { @@ -151,11 +154,10 @@ _free_pending_group (PendingGroup * pgroup) { if (pgroup->group) g_object_unref (pgroup->group); - g_list_free (pgroup->pending_children); + g_list_free_full (pgroup->pending_children, g_free); g_slice_free (PendingGroup, pgroup); } - /* enum { @@ -360,6 +362,12 @@ static void _dispose (GObject * object) { GESBaseXmlFormatterPrivate *priv = _GET_PRIV (object); + GList *pendings, *pending_clips_lists; + + pending_clips_lists = g_hash_table_get_values (priv->assetid_pendingclips); + for (pendings = pending_clips_lists; pendings; pendings = pendings->next) + g_list_free_full (pendings, (GDestroyNotify) _free_pending_clip); + g_list_free (pending_clips_lists); g_clear_pointer (&priv->assetid_pendingclips, g_hash_table_unref); g_clear_pointer (&priv->containers, g_hash_table_unref); @@ -736,9 +744,6 @@ new_asset_cb (GESAsset * source, GAsyncResult * res, PendingAsset * passet) error->message); pendings = g_hash_table_lookup (priv->assetid_pendingclips, id); - for (tmp = pendings; tmp; tmp = tmp->next) - _free_pending_clip (priv, (PendingClip *) tmp->data); - _free_pending_asset (priv, passet); goto done; } @@ -798,7 +803,6 @@ new_asset_cb (GESAsset * source, GAsyncResult * res, PendingAsset * passet) _add_track_element (self, clip, gst_object_ref (peffect->trackelement), peffect->track_id, peffect->children_properties, peffect->properties); } - _free_pending_clip (priv, pend); } /* And now add to the project */ @@ -814,6 +818,8 @@ done: g_free (possible_id); if (pendings) { + for (tmp = pendings; tmp; tmp = tmp->next) + _free_pending_clip (priv, tmp->data); g_hash_table_remove (priv->assetid_pendingclips, id); g_list_free (pendings); }