mesa/vbo: drop all references to vbo on destroy
We were adding references to the input arrays, but failing to drop them on destruction. This could lead to a 64kb buffer being leaked each context destruction.
This commit is contained in:
@@ -727,19 +727,32 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec )
|
||||
|
||||
void vbo_exec_vtx_destroy( struct vbo_exec_context *exec )
|
||||
{
|
||||
if (exec->vtx.bufferobj->Name) {
|
||||
/* using a real VBO for vertex data */
|
||||
GLcontext *ctx = exec->ctx;
|
||||
_mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL);
|
||||
}
|
||||
else {
|
||||
/* just using malloc'd space for vertex data */
|
||||
if (exec->vtx.buffer_map) {
|
||||
/* using a real VBO for vertex data */
|
||||
GLcontext *ctx = exec->ctx;
|
||||
unsigned i;
|
||||
|
||||
/* True VBOs should already be unmapped
|
||||
*/
|
||||
if (exec->vtx.buffer_map) {
|
||||
assert (exec->vtx.bufferobj->Name == 0);
|
||||
if (exec->vtx.bufferobj->Name == 0) {
|
||||
ALIGN_FREE(exec->vtx.buffer_map);
|
||||
exec->vtx.buffer_map = NULL;
|
||||
exec->vtx.buffer_ptr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Drop any outstanding reference to the vertex buffer
|
||||
*/
|
||||
for (i = 0; i < Elements(exec->vtx.arrays); i++) {
|
||||
_mesa_reference_buffer_object(ctx,
|
||||
&exec->vtx.arrays[i].BufferObj,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/* Free the vertex buffer:
|
||||
*/
|
||||
_mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL);
|
||||
}
|
||||
|
||||
void vbo_exec_BeginVertices( GLcontext *ctx )
|
||||
|
||||
Reference in New Issue
Block a user