From 7a0155e73550aa873a8b5fc6bc8d8249da71dfa5 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Tue, 19 Aug 2014 17:01:36 +1000 Subject: [PATCH] glmixer: unref the GstGLUpload in the pad if freed while running Dynamic pipelines that get and release the sink pads will finalize the pad without going through gst_gl_mixer_stop() which is where the upload object is usually freed. Don't leak objects in such case. --- ext/gl/gstglmixer.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ext/gl/gstglmixer.c b/ext/gl/gstglmixer.c index 1420b836c9..62bb4d455d 100644 --- a/ext/gl/gstglmixer.c +++ b/ext/gl/gstglmixer.c @@ -49,6 +49,7 @@ static void gst_gl_mixer_pad_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); static void gst_gl_mixer_pad_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); +static void gst_gl_mixer_pad_finalize (GObject * object); static void gst_gl_mixer_set_context (GstElement * element, GstContext * context); @@ -85,6 +86,19 @@ gst_gl_mixer_pad_class_init (GstGLMixerPadClass * klass) gobject_class->set_property = gst_gl_mixer_pad_set_property; gobject_class->get_property = gst_gl_mixer_pad_get_property; + + gobject_class->finalize = gst_gl_mixer_pad_finalize; +} + +static void +gst_gl_mixer_pad_finalize (GObject * object) +{ + GstGLMixerPad *pad = GST_GL_MIXER_PAD (object); + + if (pad->upload) { + gst_object_unref (pad->upload); + pad->upload = NULL; + } } static void