From: He Junyan Date: Wed, 4 Nov 2020 09:02:13 +0000 (+0800) Subject: gluploadelement: Avoid race condition of base class' context. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e8bb524278c7c5ac70a11a52246042df12bbb8cd;p=platform%2Fupstream%2Fgst-plugins-base.git gluploadelement: Avoid race condition of base class' context. The base class' context may change, we should use the common API with lock to access it, rather than the just directly access the struct field. Part-of: --- diff --git a/ext/gl/gstgluploadelement.c b/ext/gl/gstgluploadelement.c index fab026b..7de7bba 100644 --- a/ext/gl/gstgluploadelement.c +++ b/ext/gl/gstgluploadelement.c @@ -167,7 +167,7 @@ _gst_gl_upload_element_transform_caps (GstBaseTransform * bt, if (base_filter->display && !gst_gl_base_filter_find_gl_context (base_filter)) return NULL; - context = GST_GL_BASE_FILTER (bt)->context; + context = gst_gl_base_filter_get_gl_context (base_filter); GST_OBJECT_LOCK (upload); if (upload->upload == NULL) { @@ -191,7 +191,10 @@ _gst_gl_upload_element_transform_caps (GstBaseTransform * bt, ret_caps = gst_gl_upload_transform_caps (ul, context, direction, caps, filter); + gst_object_unref (ul); + if (context) + gst_object_unref (context); return ret_caps; }