summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/occlude.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2004-08-14 14:28:11 +0000
committerBrian Paul <[email protected]>2004-08-14 14:28:11 +0000
commit21841f0ae5ca9b55ee23ecaa3513e91b6752aa16 (patch)
treee1b1fabb444d50c23a8461ab3839761756e1fb9b /src/mesa/main/occlude.c
parentf226191d52b98eab83a1761f48c88688a4a27408 (diff)
fix some memory leaks (bug #1002030)
Diffstat (limited to 'src/mesa/main/occlude.c')
-rw-r--r--src/mesa/main/occlude.c54
1 files changed, 39 insertions, 15 deletions
diff --git a/src/mesa/main/occlude.c b/src/mesa/main/occlude.c
index d329f11f098..bc61a475d66 100644
--- a/src/mesa/main/occlude.c
+++ b/src/mesa/main/occlude.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.1
+ * Version: 6.0.2
*
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
@@ -45,20 +45,6 @@ struct occlusion_query
};
-
-void
-_mesa_init_occlude(GLcontext *ctx)
-{
-#if FEATURE_ARB_occlusion_query
- ctx->Occlusion.QueryObjects = _mesa_NewHashTable();
-#endif
-
- ctx->OcclusionResult = GL_FALSE;
- ctx->OcclusionResultSaved = GL_FALSE;
-}
-
-
-
/**
* Allocate a new occlusion query object.
* \param target - must be GL_SAMPLES_PASSED_ARB at this time
@@ -327,3 +313,41 @@ _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params)
return;
}
}
+
+
+
+/**
+ * Allocate/init the context state related to occlusion query objects.
+ */
+void
+_mesa_init_occlude(GLcontext *ctx)
+{
+#if FEATURE_ARB_occlusion_query
+ ctx->Occlusion.QueryObjects = _mesa_NewHashTable();
+#endif
+ ctx->OcclusionResult = GL_FALSE;
+ ctx->OcclusionResultSaved = GL_FALSE;
+}
+
+
+/**
+ * Free the context state related to occlusion query objects.
+ */
+void
+_mesa_free_occlude_data(GLcontext *ctx)
+{
+ while (1) {
+ GLuint query = _mesa_HashFirstEntry(ctx->Occlusion.QueryObjects);
+ if (query) {
+ struct occlusion_query *q = (struct occlusion_query *)
+ _mesa_HashLookup(ctx->Occlusion.QueryObjects, query);
+ ASSERT(q);
+ delete_query_object(q);
+ _mesa_HashRemove(ctx->Occlusion.QueryObjects, query);
+ }
+ else {
+ break;
+ }
+ }
+ _mesa_DeleteHashTable(ctx->Occlusion.QueryObjects);
+}