summaryrefslogtreecommitdiff
path: root/src/glx/x11
diff options
context:
space:
mode:
Diffstat (limited to 'src/glx/x11')
-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.