audio-source: unref private capsfilter reference on dispose

Otherwise a capsfilter reference will be leaked since it has been got
using gst_bin_get_by_name.

https://bugzilla.gnome.org/show_bug.cgi?id=766524
This commit is contained in:
Aurélien Zanelli 2016-05-16 17:36:36 +02:00 committed by Thibault Saunier
parent 4f8459b487
commit 991870fa28

View file

@ -166,14 +166,29 @@ ges_audio_source_create_element (GESTrackElement * trksrc)
return topbin; return topbin;
} }
static void
ges_audio_source_dispose (GObject * object)
{
GESAudioSource *self = GES_AUDIO_SOURCE (object);
if (self->priv->capsfilter) {
gst_object_unref (self->priv->capsfilter);
self->priv->capsfilter = NULL;
}
G_OBJECT_CLASS (ges_audio_source_parent_class)->dispose (object);
}
static void static void
ges_audio_source_class_init (GESAudioSourceClass * klass) ges_audio_source_class_init (GESAudioSourceClass * klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GESTrackElementClass *track_class = GES_TRACK_ELEMENT_CLASS (klass); GESTrackElementClass *track_class = GES_TRACK_ELEMENT_CLASS (klass);
GESAudioSourceClass *audio_source_class = GES_AUDIO_SOURCE_CLASS (klass); GESAudioSourceClass *audio_source_class = GES_AUDIO_SOURCE_CLASS (klass);
g_type_class_add_private (klass, sizeof (GESAudioSourcePrivate)); g_type_class_add_private (klass, sizeof (GESAudioSourcePrivate));
gobject_class->dispose = ges_audio_source_dispose;
track_class->nleobject_factorytype = "nlesource"; track_class->nleobject_factorytype = "nlesource";
track_class->create_element = ges_audio_source_create_element; track_class->create_element = ges_audio_source_create_element;
audio_source_class->create_source = NULL; audio_source_class->create_source = NULL;