From: David Gow Date: Tue, 5 Aug 2014 13:48:59 +0000 (+0800) Subject: Don't try to unmap buffers which aren't mapped. X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=commitdiff_plain;h=59c3413bc2bd0e6a1ddbf4e67d9d7295de10f65c Don't try to unmap buffers which aren't mapped. Fixes the GL_INAVLID_OPERATION that snuck in: this would occur when calling GraphicsBuffer::Resize() on an unmapped, non-invalidated buffer. --- diff --git a/src/graphicsbuffer.cpp b/src/graphicsbuffer.cpp index 712caf8..d3911db 100644 --- a/src/graphicsbuffer.cpp +++ b/src/graphicsbuffer.cpp @@ -185,6 +185,10 @@ void* GraphicsBuffer::MapRange(int offset, int length, bool read, bool write, bo void GraphicsBuffer::UnMap() { GLenum target = BufferTypeToGLType(m_buffer_type); + + // If we're not mapped, unmapping is a no-op. + if (!m_map_pointer) + return; if (m_faking_map) {