mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-30 04:00:37 +00:00
gluploadelement: fix leak of upload library object
When only linking the element, the upload object will be created from _transform_caps() but will never be unreffed as the only case is in _stop(). Add an unref if non-NULL to a new finalize handler for this case.
This commit is contained in:
parent
7ab50a8e8f
commit
c0cb6eacb5
1 changed files with 15 additions and 0 deletions
|
@ -61,11 +61,24 @@ GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS ("video/x-raw(ANY)"));
|
GST_STATIC_CAPS ("video/x-raw(ANY)"));
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_gl_upload_element_finalize (GObject * object)
|
||||||
|
{
|
||||||
|
GstGLUploadElement *upload = GST_GL_UPLOAD_ELEMENT (object);
|
||||||
|
|
||||||
|
if (upload->upload)
|
||||||
|
gst_object_unref (upload->upload);
|
||||||
|
upload->upload = NULL;
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_upload_element_class_init (GstGLUploadElementClass * klass)
|
gst_gl_upload_element_class_init (GstGLUploadElementClass * klass)
|
||||||
{
|
{
|
||||||
GstBaseTransformClass *bt_class = GST_BASE_TRANSFORM_CLASS (klass);
|
GstBaseTransformClass *bt_class = GST_BASE_TRANSFORM_CLASS (klass);
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||||
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
GstCaps *upload_caps;
|
GstCaps *upload_caps;
|
||||||
|
|
||||||
bt_class->transform_caps = _gst_gl_upload_element_transform_caps;
|
bt_class->transform_caps = _gst_gl_upload_element_transform_caps;
|
||||||
|
@ -91,6 +104,8 @@ gst_gl_upload_element_class_init (GstGLUploadElementClass * klass)
|
||||||
gst_element_class_set_metadata (element_class,
|
gst_element_class_set_metadata (element_class,
|
||||||
"OpenGL uploader", "Filter/Video",
|
"OpenGL uploader", "Filter/Video",
|
||||||
"Uploads data into OpenGL", "Matthew Waters <matthew@centricular.com>");
|
"Uploads data into OpenGL", "Matthew Waters <matthew@centricular.com>");
|
||||||
|
|
||||||
|
gobject_class->finalize = gst_gl_upload_element_finalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue