mesa: Don't try to remove an internal shader_program from the hash.
authorEric Anholt <eric@anholt.net>
Fri, 5 Nov 2010 14:23:45 +0000 (07:23 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 11 Mar 2011 20:55:13 +0000 (12:55 -0800)
It fails on assertions if the key isn't actually present.

src/mesa/main/shaderobj.c

index 1d75845590f07f2c9456e0ee66191ce5bcd8ab69..62de23bd100e394d5b82a5b06277cb80d08c646a 100644 (file)
@@ -72,7 +72,8 @@ _mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
       deleteFlag = (old->RefCount == 0);
 
       if (deleteFlag) {
-         _mesa_HashRemove(ctx->Shared->ShaderObjects, old->Name);
+        if (old->Name != 0)
+           _mesa_HashRemove(ctx->Shared->ShaderObjects, old->Name);
          ctx->Driver.DeleteShader(ctx, old);
       }
 
@@ -213,7 +214,8 @@ _mesa_reference_shader_program(struct gl_context *ctx,
       deleteFlag = (old->RefCount == 0);
 
       if (deleteFlag) {
-         _mesa_HashRemove(ctx->Shared->ShaderObjects, old->Name);
+        if (old->Name != 0)
+           _mesa_HashRemove(ctx->Shared->ShaderObjects, old->Name);
          ctx->Driver.DeleteShaderProgram(ctx, old);
       }