GNOME Bugzilla – Bug 766524
audio-source: unref private capsfilter reference on finalize
Last modified: 2016-06-07 16:32:22 UTC
When create elements of audio-source, we currently get a reference on capsfilter using gst_bin_get_by_name but we never unref it causing element to leak.
Created attachment 327990 [details] [review] [1/2] audio-source: fix indentation A minor patch to fix indentation of file
Created attachment 327991 [details] [review] [2/2] audio-source: unref private capsfilter reference on finalize Patch proposal to fix the issue. It add a finalize implementation and unref capsfilter in it.
Review of attachment 327991 [details] [review]: ::: ges/ges-audio-source.c @@ +172,3 @@ + GESAudioSource *self = GES_AUDIO_SOURCE (object); + + gst_object_unref (self->priv->capsfilter); First check if it is not NULL, it might be as it is created in create_element.
Review of attachment 327990 [details] [review]: OK
Created attachment 327995 [details] [review] [2/2] audio-source: unref private capsfilter reference on finalize With NULL check
Review of attachment 327995 [details] [review]: Actually reference dropping should happen in ->dispose, not ->finalize
Created attachment 327996 [details] [review] [2/2] audio-source: unref private capsfilter reference on dispose (In reply to Thibault Saunier from comment #6) > Review of attachment 327995 [details] [review] [review]: > > Actually reference dropping should happen in ->dispose, not ->finalize That's right :)
Review of attachment 327996 [details] [review]: ::: ges/ges-audio-source.c @@ +173,3 @@ + + if (self->priv->capsfilter) + gst_object_unref (self->priv->capsfilter); You should use gst_object_replace or set it back to NULL, dispose can be called several times :)
Created attachment 327998 [details] [review] [2/2] audio-source: unref private capsfilter reference on dispose I think I'm too tired today.