summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKristof Ralovich <kristof.ralovich@gmail.com>2008-08-20 15:18:38 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-08-20 15:33:03 -0600
commite2060348630b59a446bac7f734fdde40033093ab (patch)
tree2920967978965236aa4e4f667513d70fe72ca5a8 /src
parentfb36a54a1c327efc6602ff104b097359f9823931 (diff)
glx: free vertex array state when context is destroyed
Diffstat (limited to 'src')
-rw-r--r--src/glx/x11/glxclient.h5
-rw-r--r--src/glx/x11/glxcmds.c2
-rw-r--r--src/glx/x11/indirect_vertex_array.c25
3 files changed, 30 insertions, 2 deletions
diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h
index 8143289ecc..e2b4218200 100644
--- a/src/glx/x11/glxclient.h
+++ b/src/glx/x11/glxclient.h
@@ -695,9 +695,10 @@ extern void __glEmptyImage(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum,
/*
-** Allocate and Initialize Vertex Array client state
+** Allocate and Initialize Vertex Array client state, and free.
*/
-extern void __glXInitVertexArrayState(__GLXcontext*);
+extern void __glXInitVertexArrayState(__GLXcontext *);
+extern void __glXFreeVertexArrayState(__GLXcontext *);
/*
** Inform the Server of the major and minor numbers and of the client
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
index 6cafb33b1f..0f0cb6233a 100644
--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -532,6 +532,8 @@ DestroyContext(Display *dpy, GLXContext gc)
}
#endif
+ __glXFreeVertexArrayState(gc);
+
if (gc->currentDpy) {
/* Have to free later cuz it's in use now */
__glXUnlock();
diff --git a/src/glx/x11/indirect_vertex_array.c b/src/glx/x11/indirect_vertex_array.c
index 15e3ece148..c7a20e2bc5 100644
--- a/src/glx/x11/indirect_vertex_array.c
+++ b/src/glx/x11/indirect_vertex_array.c
@@ -101,6 +101,31 @@ const GLuint __glXTypeSize_table[16] = {
};
+/**
+ * Free the per-context array state that was allocated with
+ * __glXInitVertexArrayState().
+ */
+void
+__glXFreeVertexArrayState( __GLXcontext * gc )
+{
+ __GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
+ struct array_state_vector* arrays = state->array_state;
+
+ if (arrays) {
+ if (arrays->stack) {
+ free(arrays->stack);
+ arrays->stack = NULL;
+ }
+ if (arrays->arrays) {
+ free(arrays->arrays);
+ arrays->arrays = NULL;
+ }
+ free(arrays);
+ arrays = NULL;
+ state->array_state = NULL;
+ }
+}
+
/**
* Initialize vertex array state of a GLX context.