GESTimelineObject: Don't leak a reference when creating TrackObject
authorEdward Hervey <bilboed@bilboed.com>
Sat, 13 Mar 2010 14:52:14 +0000 (15:52 +0100)
committerEdward Hervey <bilboed@bilboed.com>
Sat, 13 Mar 2010 14:54:32 +0000 (15:54 +0100)
ges/ges-timeline-object.c
tests/check/ges/filesource.c

index 4f00ad6..97baafb 100644 (file)
@@ -193,8 +193,8 @@ ges_timeline_object_create_track_object (GESTimelineObject * object,
     ges_track_object_set_timeline_object (res, object);
 
     GST_DEBUG ("Adding TrackObject to the list of controlled track objects");
-    object->trackobjects =
-        g_list_append (object->trackobjects, g_object_ref (res));
+    /* We steal the initial reference */
+    object->trackobjects = g_list_append (object->trackobjects, res);
 
     GST_DEBUG ("Setting properties on newly created TrackObject");
 
index 7c100be..1890857 100644 (file)
@@ -49,13 +49,11 @@ GST_START_TEST (test_filesource_basic)
   fail_unless (trackobject != NULL);
 
   /* The track holds a reference to the object */
-  ASSERT_OBJECT_REFCOUNT (trackobject, "Track Object", 2);
+  ASSERT_OBJECT_REFCOUNT (trackobject, "Track Object", 1);
 
   fail_unless (ges_timeline_object_release_track_object (GES_TIMELINE_OBJECT
           (source), trackobject) == TRUE);
 
-  ASSERT_OBJECT_REFCOUNT (trackobject, "Track Object", 1);
-
   g_object_unref (source);
   g_object_unref (track);
 }