From: Eric Anholt Date: Tue, 4 Oct 2011 22:36:15 +0000 (-0700) Subject: mesa: Prevent repeated glDeleteProgram() from blowing away our refcounts. X-Git-Tag: mesa-8.0-rc1~1748 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d950a778b7b86526d3968deee232444af64d8cf1;p=platform%2Fupstream%2Fmesa.git mesa: Prevent repeated glDeleteProgram() from blowing away our refcounts. glDeleteProgram should only be able to remove the one refcount for the user's reference to the program from the hash table (even though that ref does live on in the hash table until the last other ref is removed). Fixes piglit ARB_shader_objects/delete-repeat. Reviewed-by: Chad Versace Reviewed-by: Ian Romanick --- diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index c3aabe4..6868dfa 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -390,10 +390,12 @@ delete_shader_program(struct gl_context *ctx, GLuint name) if (!shProg) return; - shProg->DeletePending = GL_TRUE; + if (!shProg->DeletePending) { + shProg->DeletePending = GL_TRUE; - /* effectively, decr shProg's refcount */ - _mesa_reference_shader_program(ctx, &shProg, NULL); + /* effectively, decr shProg's refcount */ + _mesa_reference_shader_program(ctx, &shProg, NULL); + } }