summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/pixel.c
diff options
context:
space:
mode:
authorMichal Krol <[email protected]>2010-02-09 14:25:41 +0100
committerMichal Krol <[email protected]>2010-02-09 14:52:52 +0100
commit01d7e3d5a25a7cc49b38f5561d00c2ff22c43e93 (patch)
treecaa96a292b385ab401544714bdb907b1d6ee478f /src/mesa/main/pixel.c
parenteeec2c3d951fed0d22e5dbf436d4a2d887e24221 (diff)
mesa: Enable true refcounting for NullBufferObj.
This object can be shared with another context, so we cannot just delete it when the owning context is being destroyed. Ensuring that buffer objects are properly refcounted guarantees NullBufferObj is destroyed when all references to it are removed.
Diffstat (limited to 'src/mesa/main/pixel.c')
-rw-r--r--src/mesa/main/pixel.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c
index f6f9c1173a1..ca6ecd7bfb6 100644
--- a/src/mesa/main/pixel.c
+++ b/src/mesa/main/pixel.c
@@ -150,13 +150,17 @@ validate_pbo_access(GLcontext *ctx, struct gl_pixelstore_attrib *pack,
GLboolean ok;
/* Note, need to use DefaultPacking and Unpack's buffer object */
- ctx->DefaultPacking.BufferObj = pack->BufferObj;
+ _mesa_reference_buffer_object(ctx,
+ &ctx->DefaultPacking.BufferObj,
+ pack->BufferObj);
ok = _mesa_validate_pbo_access(1, &ctx->DefaultPacking, mapsize, 1, 1,
format, type, ptr);
/* restore */
- ctx->DefaultPacking.BufferObj = ctx->Shared->NullBufferObj;
+ _mesa_reference_buffer_object(ctx,
+ &ctx->DefaultPacking.BufferObj,
+ ctx->Shared->NullBufferObj);
if (!ok) {
_mesa_error(ctx, GL_INVALID_OPERATION,