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 <chad@chad-versace.us>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Eric Anholt
2011-10-04 15:36:15 -07:00
parent 7457da5edd
commit d950a778b7
+5 -3
View File
@@ -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);
}
}