delete shader objects when destroying shared context state
authorBrian Paul <brian.paul@tungstengraphics.com>
Sat, 18 Nov 2006 17:44:28 +0000 (17:44 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Sat, 18 Nov 2006 17:44:28 +0000 (17:44 +0000)
src/mesa/main/context.c

index c8acc6b55ca50639b542db4c625205aa1c16e649..44ee04656907e480b1cb3743e1d8ed4f6d8c2210 100644 (file)
@@ -876,6 +876,16 @@ delete_arrayobj_cb(GLuint id, void *data, void *userData)
    _mesa_delete_array_object(ctx, arrayObj);
 }
 
+/**
+ * Callback for deleting an shader object.  Called by _mesa_HashDeleteAll().
+ */
+static void
+delete_shaderobj_cb(GLuint id, void *data, void *userData)
+{
+   /* XXX probably need to fix this */
+   _mesa_free(data);
+}
+
 
 /**
  * Deallocate a shared state object and all children structures.
@@ -938,6 +948,7 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss )
    _mesa_DeleteHashTable(ss->ArrayObjects);
 
 #if FEATURE_ARB_shader_objects
+   _mesa_HashDeleteAll(ss->GL2Objects, delete_shaderobj_cb, ctx);
    _mesa_DeleteHashTable(ss->GL2Objects);
 #endif