After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 766524 - audio-source: unref private capsfilter reference on finalize
audio-source: unref private capsfilter reference on finalize
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-editing-services
git master
Other Linux
: Normal normal
: 1.8.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-05-16 15:50 UTC by Aurélien Zanelli
Modified: 2016-06-07 16:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[1/2] audio-source: fix indentation (930 bytes, patch)
2016-05-16 15:51 UTC, Aurélien Zanelli
committed Details | Review
[2/2] audio-source: unref private capsfilter reference on finalize (1.51 KB, patch)
2016-05-16 15:53 UTC, Aurélien Zanelli
none Details | Review
[2/2] audio-source: unref private capsfilter reference on finalize (1.55 KB, patch)
2016-05-16 16:34 UTC, Aurélien Zanelli
none Details | Review
[2/2] audio-source: unref private capsfilter reference on dispose (1.54 KB, patch)
2016-05-16 17:07 UTC, Aurélien Zanelli
none Details | Review
[2/2] audio-source: unref private capsfilter reference on dispose (1.59 KB, patch)
2016-05-16 17:19 UTC, Aurélien Zanelli
committed Details | Review

Description Aurélien Zanelli 2016-05-16 15:50:09 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.
Comment 1 Aurélien Zanelli 2016-05-16 15:51:49 UTC
Created attachment 327990 [details] [review]
[1/2] audio-source: fix indentation

A minor patch to fix indentation of file
Comment 2 Aurélien Zanelli 2016-05-16 15:53:05 UTC
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.
Comment 3 Thibault Saunier 2016-05-16 16:20:26 UTC
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.
Comment 4 Thibault Saunier 2016-05-16 16:20:29 UTC
Review of attachment 327990 [details] [review]:

OK
Comment 5 Aurélien Zanelli 2016-05-16 16:34:48 UTC
Created attachment 327995 [details] [review]
[2/2] audio-source: unref private capsfilter reference on finalize

With NULL check
Comment 6 Thibault Saunier 2016-05-16 16:59:01 UTC
Review of attachment 327995 [details] [review]:

Actually reference dropping should happen in ->dispose, not ->finalize
Comment 7 Aurélien Zanelli 2016-05-16 17:07:32 UTC
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 :)
Comment 8 Thibault Saunier 2016-05-16 17:11:41 UTC
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 :)
Comment 9 Aurélien Zanelli 2016-05-16 17:19:49 UTC
Created attachment 327998 [details] [review]
[2/2] audio-source: unref private capsfilter reference on dispose

I think I'm too tired today.