GESTimeline: Properly iterate TrackObject lists when removing them
authorEdward Hervey <bilboed@bilboed.com>
Fri, 12 Mar 2010 17:42:28 +0000 (18:42 +0100)
committerEdward Hervey <bilboed@bilboed.com>
Sat, 13 Mar 2010 14:56:57 +0000 (15:56 +0100)
ges/ges-timeline.c

index 631580c7390862caa48c8e2926f7d86b534ac868..f2990063a534bbd0f38cd0898f1fba286a1ff047 100644 (file)
@@ -248,16 +248,18 @@ static void
 layer_object_removed_cb (GESTimelineLayer * layer, GESTimelineObject * object,
     GESTimeline * timeline)
 {
-  GList *tmp;
+  GList *tmp, *next;
 
   GST_DEBUG ("TimelineObject %p removed from layer %p", object, layer);
 
   /* Go over the object's track objects and figure out which one belongs to
    * the list of tracks we control */
 
-  for (tmp = object->trackobjects; tmp; tmp = g_list_next (tmp)) {
+  for (tmp = object->trackobjects; tmp; tmp = next) {
     GESTrackObject *trobj = (GESTrackObject *) tmp->data;
 
+    next = g_list_next (tmp);
+
     GST_DEBUG ("Trying to remove TrackObject %p", trobj);
     if (G_LIKELY (g_list_find_custom (timeline->tracks,
                 (gconstpointer) trobj->track,