Actually free buffer objects

With the refactoring to centralize code into CoglBuffer,
_cogl_buffer_fini() was never actually implemented, so all GL
vertex and index buffer objects were leaked.

The duplicate call to glDeleteBuffers() in CoglPixelArray is
removed (it wasn't paying attention to whether the buffer had been
allocated as a PBO or not.)

http://bugzilla.clutter-project.org/show_bug.cgi?id=2423
This commit is contained in:
Owen W. Taylor 2010-11-14 22:59:24 -05:00 committed by Robert Bragg
parent 460e4b90d3
commit fae591b168
2 changed files with 7 additions and 2 deletions

View File

@ -299,8 +299,15 @@ _cogl_buffer_initialize (CoglBuffer *buffer,
void
_cogl_buffer_fini (CoglBuffer *buffer)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (!(buffer->flags & COGL_BUFFER_FLAG_MAPPED));
g_return_if_fail (buffer->immutable_ref == 0);
if (buffer->flags & COGL_BUFFER_FLAG_BUFFER_OBJECT)
GE( glDeleteBuffers (1, &buffer->gl_handle) );
else
g_free (buffer->data);
}
/* OpenGL ES 1.1 and 2 have a GL_OES_mapbuffer extension that is able to map

View File

@ -147,8 +147,6 @@ _cogl_pixel_array_free (CoglPixelArray *buffer)
/* parent's destructor */
_cogl_buffer_fini (COGL_BUFFER (buffer));
GE( glDeleteBuffers (1, &(COGL_BUFFER (buffer)->gl_handle)) );
g_slice_free (CoglPixelArray, buffer);
}