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
This commit is contained in:
Sebastian Dröge 2017-05-15 12:00:50 +03:00 committed by Tim-Philipp Müller
parent d47a515315
commit 6b1fa09077

View file

@ -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().