summaryrefslogtreecommitdiff
path: root/gst-libs/gst/gl/gstglshader.c
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2017-05-15 12:00:50 +0300
committerSebastian Dröge <sebastian@centricular.com>2017-05-15 12:07:13 +0300
commit65545ecfa360ba28754611d077d9bb485c6a5d19 (patch)
treefc0bdcab28f42571761b37951844061521bb435f /gst-libs/gst/gl/gstglshader.c
parent9fae0055e72bda38afff383dc1ccd1968334fd02 (diff)
downloadgstreamer-plugins-bad-65545ecfa360ba28754611d077d9bb485c6a5d19.tar.gz
glshader: Make reference counting of attach() consistent
https://bugzilla.gnome.org/show_bug.cgi?id=747990 https://bugzilla.gnome.org/show_bug.cgi?id=702960
Diffstat (limited to 'gst-libs/gst/gl/gstglshader.c')
-rw-r--r--gst-libs/gst/gl/gstglshader.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/gst-libs/gst/gl/gstglshader.c b/gst-libs/gst/gl/gstglshader.c
index c15568dbc..ab348f163 100644
--- a/gst-libs/gst/gl/gstglshader.c
+++ b/gst-libs/gst/gl/gstglshader.c
@@ -500,7 +500,7 @@ gst_gl_shader_detach (GstGLShader * shader, GstGLSLStage * stage)
/**
* gst_gl_shader_attach_unlocked:
* @shader: a #GstGLShader
- * @stage: a #GstGLSLStage to attach
+ * @stage: (transfer floating): a #GstGLSLStage to attach
*
* Attaches @stage to @shader. @stage must have been successfully compiled
* with gst_glsl_stage_compile().
@@ -521,18 +521,28 @@ gst_gl_shader_attach_unlocked (GstGLShader * shader, GstGLSLStage * stage)
if (!_gst_glsl_funcs_fill (&shader->priv->vtable, shader->context)) {
GST_WARNING_OBJECT (shader, "Failed to retreive required GLSL functions");
+ gst_object_ref_sink (stage);
+ gst_object_unref (stage);
return FALSE;
}
- if (!_ensure_program (shader))
+ if (!_ensure_program (shader)) {
+ gst_object_ref_sink (stage);
+ gst_object_unref (stage);
return FALSE;
+ }
/* already attached? */
- if (g_list_find (shader->priv->stages, stage))
+ if (g_list_find (shader->priv->stages, stage)) {
+ gst_object_ref_sink (stage);
+ gst_object_unref (stage);
return TRUE;
+ }
stage_handle = gst_glsl_stage_get_handle (stage);
if (!stage_handle) {
+ gst_object_ref_sink (stage);
+ gst_object_unref (stage);
return FALSE;
}
@@ -555,7 +565,7 @@ gst_gl_shader_attach_unlocked (GstGLShader * shader, GstGLSLStage * stage)
/**
* gst_gl_shader_attach:
* @shader: a #GstGLShader
- * @stage: a #GstGLSLStage to attach
+ * @stage: (transfer floating): a #GstGLSLStage to attach
*
* Attaches @stage to @shader. @stage must have been successfully compiled
* with gst_glsl_stage_compile().