glx: free vertex array state when context is destroyed

This commit is contained in:
Kristof Ralovich 2008-08-20 15:18:38 -06:00 committed by Brian Paul
parent fb36a54a1c
commit e206034863
3 changed files with 30 additions and 2 deletions

View File

@ -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

View File

@ -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();

View File

@ -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.