gst-editing-services: Disconnect handlers when object is removed from layer

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


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

Author: mathieu duponchelle <duponc_m at Meh.(none)>
Date:   Fri Dec 23 17:16:20 2011 +0100

Disconnect handlers when object is removed from layer

---

 ges/ges-timeline-layer.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/ges/ges-timeline-layer.c b/ges/ges-timeline-layer.c
index d39e260..65ffefe 100644
--- a/ges/ges-timeline-layer.c
+++ b/ges/ges-timeline-layer.c
@@ -216,7 +216,7 @@ ges_timeline_layer_init (GESTimelineLayer * self)
   self->max_gnl_priority = LAYER_HEIGHT;
   self->priv->signal_table =
       g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref,
-      g_free);
+      NULL);
 }
 
 /**
@@ -434,7 +434,7 @@ track_object_added_cb (GESTimelineObject * object,
   if (!g_hash_table_lookup (signal_table, track)) {
     ptr = g_signal_connect (track, "track-object-removed",
         (GCallback) track_object_deleted_cb, NULL);
-    g_hash_table_insert (signal_table, track, &ptr);
+    g_hash_table_insert (signal_table, track, GINT_TO_POINTER (ptr));
   }
   return;
 }
@@ -749,6 +749,14 @@ look_for_transition (GESTrackObject * track_object, GESTimelineLayer * layer)
   g_list_free_full (track_objects, g_object_unref);
 }
 
+static gboolean
+disconnect_handlers (GESTrack * track, gpointer * ptr)
+{
+  g_signal_handler_disconnect (track, GPOINTER_TO_INT (ptr));
+
+  return TRUE;
+}
+
 /**
  * ges_timeline_layer_remove_object:
  * @layer: a #GESTimelineLayer
@@ -793,6 +801,9 @@ ges_timeline_layer_remove_object (GESTimelineLayer * layer,
     g_list_free_full (trackobjects, g_object_unref);
   }
 
+  g_hash_table_foreach_remove (layer->priv->signal_table,
+      (GHRFunc) disconnect_handlers, NULL);
+
   /* emit 'object-removed' */
   g_signal_emit (layer, ges_timeline_layer_signals[OBJECT_REMOVED], 0, object);
 



More information about the gstreamer-commits mailing list