cogl-buffer: consider it an error to free a mapped buffer

Explicitly warn if we detect that a CoglBuffer is being freed while it
is still mapped. Previously we silently unmapped the buffer, but it's
not something we want to encourage.
This commit is contained in:
Robert Bragg 2010-07-05 23:32:55 +01:00
parent e98ee6665b
commit f8d58446a8
2 changed files with 3 additions and 3 deletions

View File

@ -132,8 +132,7 @@ _cogl_buffer_initialize (CoglBuffer *buffer,
void void
_cogl_buffer_fini (CoglBuffer *buffer) _cogl_buffer_fini (CoglBuffer *buffer)
{ {
if (COGL_BUFFER_FLAG_IS_SET (buffer, MAPPED)) g_return_if_fail (!COGL_BUFFER_FLAG_IS_SET (buffer, MAPPED));
cogl_buffer_unmap (buffer);
} }
GLenum GLenum

View File

@ -191,7 +191,8 @@ typedef enum { /*< prefix=COGL_BUFFER_MAP_HINT >*/
* new buffer to map. * new buffer to map.
* *
* The behaviour is undefined if you access the buffer in a way * The behaviour is undefined if you access the buffer in a way
* conflicting with the @access mask you pass. * conflicting with the @access mask you pass. It is also an error to
* release your last reference while the buffer is mapped.
* *
* Return value: A pointer to the mapped memory or %NULL is the call fails * Return value: A pointer to the mapped memory or %NULL is the call fails
* *