GESTimelineLayer: Subclass from GInitiallyUnowned

The floating reference will be owned by the Timeline
This commit is contained in:
Edward Hervey 2010-12-20 12:00:06 +01:00
parent 752e6cfb75
commit 11887e0058
4 changed files with 8 additions and 4 deletions

View file

@ -33,7 +33,7 @@
#include "ges-timeline-layer.h" #include "ges-timeline-layer.h"
#include "ges.h" #include "ges.h"
G_DEFINE_TYPE (GESTimelineLayer, ges_timeline_layer, G_TYPE_OBJECT); G_DEFINE_TYPE (GESTimelineLayer, ges_timeline_layer, G_TYPE_INITIALLY_UNOWNED);
struct _GESTimelineLayerPrivate struct _GESTimelineLayerPrivate
{ {

View file

@ -50,7 +50,7 @@ typedef struct _GESTimelineLayerPrivate GESTimelineLayerPrivate;
* @timeline: the #GESTimeline where this layer is being used. * @timeline: the #GESTimeline where this layer is being used.
*/ */
struct _GESTimelineLayer { struct _GESTimelineLayer {
GObject parent; GInitiallyUnowned parent;
/*< public >*/ /*< public >*/
@ -74,7 +74,7 @@ struct _GESTimelineLayer {
*/ */
struct _GESTimelineLayerClass { struct _GESTimelineLayerClass {
/*< private >*/ /*< private >*/
GObjectClass parent_class; GInitiallyUnownedClass parent_class;
/*< public >*/ /*< public >*/
/* virtual methods for subclasses */ /* virtual methods for subclasses */

View file

@ -608,7 +608,7 @@ ges_timeline_add_layer (GESTimeline * timeline, GESTimelineLayer * layer)
return FALSE; return FALSE;
} }
/* Reference is stolen */ g_object_ref_sink (layer);
timeline->layers = g_list_append (timeline->layers, layer); timeline->layers = g_list_append (timeline->layers, layer);
/* Inform the layer that it belongs to a new timeline */ /* Inform the layer that it belongs to a new timeline */

View file

@ -73,7 +73,11 @@ GST_START_TEST (test_layer_properties)
/* The default priority is 0 */ /* The default priority is 0 */
fail_unless_equals_int (ges_timeline_layer_get_priority (layer), 0); fail_unless_equals_int (ges_timeline_layer_get_priority (layer), 0);
/* Layers are initially floating, once we add them to the timeline,
* the timeline will take that reference. */
fail_unless (g_object_is_floating (layer));
fail_unless (ges_timeline_add_layer (timeline, layer)); fail_unless (ges_timeline_add_layer (timeline, layer));
fail_if (g_object_is_floating (layer));
track = ges_track_new (GES_TRACK_TYPE_CUSTOM, GST_CAPS_ANY); track = ges_track_new (GES_TRACK_TYPE_CUSTOM, GST_CAPS_ANY);
fail_unless (track != NULL); fail_unless (track != NULL);