Mesa (master): mesa: Prevent repeated glDeleteProgram() from blowing away our refcounts.

Eric Anholt anholt at kemper.freedesktop.org
Mon Oct 10 11:44:27 PDT 2011


Module: Mesa
Branch: master
Commit: d950a778b7b86526d3968deee232444af64d8cf1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d950a778b7b86526d3968deee232444af64d8cf1

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Oct  4 15:36:15 2011 -0700

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 at chad-versace.us>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mesa/main/shaderapi.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

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);
+   }
 }
 
 



More information about the mesa-commit mailing list