summaryrefslogtreecommitdiff
path: root/src/mesa/main/arrayobj.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-09-04 14:58:02 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-09-04 14:59:40 -0600
commit37c74af01ce52b603f565a6c8a9094500d5cb87a (patch)
tree8c1a0207de4a4a623d32a3f686170205c984e779 /src/mesa/main/arrayobj.c
parent4a32f0c63886b985743ecadc24fd60a23864c491 (diff)
mesa: improved gl_buffer_object reference counting
Use new _mesa_reference_buffer_object() function wherever possible. Fixes buffer object/display list crash reported in ParaView.
Diffstat (limited to 'src/mesa/main/arrayobj.c')
-rw-r--r--src/mesa/main/arrayobj.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index f08f99d8e1..0bc582602e 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 7.2
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
* (C) Copyright IBM Corporation 2006
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -210,6 +210,15 @@ _mesa_remove_array_object( GLcontext *ctx, struct gl_array_object *obj )
}
+static void
+unbind_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj )
+{
+ if (bufObj != ctx->Array.NullBufferObj) {
+ _mesa_reference_buffer_object(ctx, &bufObj, NULL);
+ }
+}
+
+
/**********************************************************************/
/* API Functions */
/**********************************************************************/
@@ -311,18 +320,18 @@ _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids)
/* Unbind any buffer objects that might be bound to arrays in
* this array object.
*/
- _mesa_unbind_buffer_object( ctx, obj->Vertex.BufferObj );
- _mesa_unbind_buffer_object( ctx, obj->Normal.BufferObj );
- _mesa_unbind_buffer_object( ctx, obj->Color.BufferObj );
- _mesa_unbind_buffer_object( ctx, obj->SecondaryColor.BufferObj );
- _mesa_unbind_buffer_object( ctx, obj->FogCoord.BufferObj );
- _mesa_unbind_buffer_object( ctx, obj->Index.BufferObj );
+ unbind_buffer_object( ctx, obj->Vertex.BufferObj );
+ unbind_buffer_object( ctx, obj->Normal.BufferObj );
+ unbind_buffer_object( ctx, obj->Color.BufferObj );
+ unbind_buffer_object( ctx, obj->SecondaryColor.BufferObj );
+ unbind_buffer_object( ctx, obj->FogCoord.BufferObj );
+ unbind_buffer_object( ctx, obj->Index.BufferObj );
for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
- _mesa_unbind_buffer_object( ctx, obj->TexCoord[i].BufferObj );
+ unbind_buffer_object( ctx, obj->TexCoord[i].BufferObj );
}
- _mesa_unbind_buffer_object( ctx, obj->EdgeFlag.BufferObj );
+ unbind_buffer_object( ctx, obj->EdgeFlag.BufferObj );
for (i = 0; i < VERT_ATTRIB_MAX; i++) {
- _mesa_unbind_buffer_object( ctx, obj->VertexAttrib[i].BufferObj );
+ unbind_buffer_object( ctx, obj->VertexAttrib[i].BufferObj );
}
#endif