summaryrefslogtreecommitdiff
path: root/src/mesa/vbo/vbo_save.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/vbo/vbo_save.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/vbo/vbo_save.c')
-rw-r--r--src/mesa/vbo/vbo_save.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/mesa/vbo/vbo_save.c b/src/mesa/vbo/vbo_save.c
index 8dd87141c0..9757c3d9f6 100644
--- a/src/mesa/vbo/vbo_save.c
+++ b/src/mesa/vbo/vbo_save.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 7.2
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -27,6 +27,7 @@
#include "main/mtypes.h"
+#include "main/bufferobj.h"
#include "main/dlist.h"
#include "main/vtxfmt.h"
#include "main/imports.h"
@@ -71,19 +72,24 @@ void vbo_save_destroy( GLcontext *ctx )
{
struct vbo_context *vbo = vbo_context(ctx);
struct vbo_save_context *save = &vbo->save;
+ GLuint i;
+
if (save->prim_store) {
if ( --save->prim_store->refcount == 0 ) {
FREE( save->prim_store );
save->prim_store = NULL;
}
if ( --save->vertex_store->refcount == 0 ) {
- if (save->vertex_store->bufferobj)
- ctx->Driver.DeleteBuffer( ctx, save->vertex_store->bufferobj );
-
+ _mesa_reference_buffer_object(ctx,
+ &save->vertex_store->bufferobj, NULL);
FREE( save->vertex_store );
save->vertex_store = NULL;
}
}
+
+ for (i = 0; i < VBO_ATTRIB_MAX; i++) {
+ _mesa_reference_buffer_object(ctx, &save->arrays[i].BufferObj, NULL);
+ }
}