gst-editing-services: ges: Don' t release unexisting sources when destroying the formatter

Thibault Saunier tsaunier at kemper.freedesktop.org
Wed Jan 11 07:04:33 PST 2012


Module: gst-editing-services
Branch: master
Commit: 876add1fe5acc422514cd4e13458a8f887a709c7
URL:    http://cgit.freedesktop.org/gstreamer/gst-editing-services/commit/?id=876add1fe5acc422514cd4e13458a8f887a709c7

Author: Stéphane Maniaci <stephane.maniaci at gmail.com>
Date:   Sun Oct  9 12:28:39 2011 -0400

ges: Don't release unexisting sources when destroying the formatter

This happens in case of an empty project.

---

 ges/ges-pitivi-formatter.c |   37 +++++++++++++++++++++++--------------
 1 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/ges/ges-pitivi-formatter.c b/ges/ges-pitivi-formatter.c
index 590491e..0909554 100644
--- a/ges/ges-pitivi-formatter.c
+++ b/ges/ges-pitivi-formatter.c
@@ -92,21 +92,30 @@ ges_pitivi_formatter_finalize (GObject * object)
 {
   GESPitiviFormatter *self = GES_PITIVI_FORMATTER (object);
   GESPitiviFormatterPrivate *priv = GES_PITIVI_FORMATTER (self)->priv;
-  g_hash_table_foreach (priv->source_table, (GHFunc) ultimate_table_destroyer,
-      NULL);
-  g_hash_table_destroy (priv->source_table);
 
-  g_hash_table_foreach (priv->timeline_objects_table,
-      (GHFunc) list_table_destroyer, NULL);
-  g_hash_table_destroy (priv->timeline_objects_table);
+  if (priv->source_table != NULL) {
+    g_hash_table_foreach (priv->source_table,
+        (GHFunc) ultimate_table_destroyer, NULL);
+    g_hash_table_destroy (priv->source_table);
+  }
 
-  g_hash_table_foreach (priv->layers_table, (GHFunc) layers_table_destroyer,
-      NULL);
-  g_hash_table_destroy (priv->layers_table);
+  if (priv->timeline_objects_table != NULL) {
+    g_hash_table_foreach (priv->timeline_objects_table,
+        (GHFunc) list_table_destroyer, NULL);
+    g_hash_table_destroy (priv->timeline_objects_table);
+  }
 
-  g_hash_table_foreach (priv->track_objects_table,
-      (GHFunc) ultimate_table_destroyer, NULL);
-  g_hash_table_destroy (priv->track_objects_table);
+  if (priv->layers_table != NULL) {
+    g_hash_table_foreach (priv->layers_table,
+        (GHFunc) layers_table_destroyer, NULL);
+    g_hash_table_destroy (priv->layers_table);
+  }
+
+  if (priv->track_objects_table != NULL) {
+    g_hash_table_foreach (priv->track_objects_table,
+        (GHFunc) ultimate_table_destroyer, NULL);
+    g_hash_table_destroy (priv->track_objects_table);
+  }
 
   G_OBJECT_CLASS (ges_pitivi_formatter_parent_class)->finalize (object);
 }



More information about the gstreamer-commits mailing list