From 2353aa56eacbe13f1024cc066a129615e10583d3 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Mon, 5 Jul 2010 23:32:55 +0100 Subject: [PATCH] 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. --- clutter/cogl/cogl/cogl-buffer.c | 3 +-- clutter/cogl/cogl/cogl-buffer.h | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clutter/cogl/cogl/cogl-buffer.c b/clutter/cogl/cogl/cogl-buffer.c index 1000d74dc..a4e9e66c5 100644 --- a/clutter/cogl/cogl/cogl-buffer.c +++ b/clutter/cogl/cogl/cogl-buffer.c @@ -132,8 +132,7 @@ _cogl_buffer_initialize (CoglBuffer *buffer, void _cogl_buffer_fini (CoglBuffer *buffer) { - if (COGL_BUFFER_FLAG_IS_SET (buffer, MAPPED)) - cogl_buffer_unmap (buffer); + g_return_if_fail (!COGL_BUFFER_FLAG_IS_SET (buffer, MAPPED)); } GLenum diff --git a/clutter/cogl/cogl/cogl-buffer.h b/clutter/cogl/cogl/cogl-buffer.h index 7c61b51dc..8ad45a233 100644 --- a/clutter/cogl/cogl/cogl-buffer.h +++ b/clutter/cogl/cogl/cogl-buffer.h @@ -191,7 +191,8 @@ typedef enum { /*< prefix=COGL_BUFFER_MAP_HINT >*/ * new buffer to map. * * 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 *