diff options
author | José Fonseca <jfonseca@vmware.com> | 2010-02-01 21:30:50 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2010-02-09 11:52:05 +0000 |
commit | 05ac187f305bb653d569b5c07446ec0f4cd7ff08 (patch) | |
tree | ff87c0cfe76e67e55496563dbfbb5f4cb576dc81 /src/mesa/vbo | |
parent | 1c39dbb90cefad8a5a97e75042466d66ea4270bc (diff) |
mesa: Fix null buffer object reference counting.
Always use _mesa_reference_buffer_object, and never call
ctx->Driver.DeleteBuffer() directly to prevent dangling pointers to the
null buffer object.
This fixes crash/assertions in sharedtex_mt and Autodesk Mudbox.
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r-- | src/mesa/vbo/vbo_save.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mesa/vbo/vbo_save.c b/src/mesa/vbo/vbo_save.c index 10f705cf84..fd9a130270 100644 --- a/src/mesa/vbo/vbo_save.c +++ b/src/mesa/vbo/vbo_save.c @@ -58,8 +58,19 @@ void vbo_save_init( GLcontext *ctx ) { struct gl_client_array *arrays = save->arrays; + unsigned i; + memcpy(arrays, vbo->legacy_currval, 16 * sizeof(arrays[0])); memcpy(arrays + 16, vbo->generic_currval, 16 * sizeof(arrays[0])); + + for (i = 0; i < 16; ++i) { + arrays[i ].BufferObj = NULL; + arrays[i + 16].BufferObj = NULL; + _mesa_reference_buffer_object(ctx, &arrays[i ].BufferObj, + vbo->legacy_currval[i].BufferObj); + _mesa_reference_buffer_object(ctx, &arrays[i + 16].BufferObj, + vbo->generic_currval[i].BufferObj); + } } ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; |