r300g: fix reference counting when translating indices
authorMarek Olšák <maraeo@gmail.com>
Mon, 14 Feb 2011 05:26:56 +0000 (06:26 +0100)
committerMarek Olšák <maraeo@gmail.com>
Mon, 14 Feb 2011 06:45:14 +0000 (07:45 +0100)
src/gallium/drivers/r300/r300_render_translate.c

index dbc64ebf827fcf6bf8736ef2859a8ad7fe333f54..777857514fc770eea927eefd6e65dbb60f8eb492 100644 (file)
@@ -44,6 +44,7 @@ void r300_translate_index_buffer(struct r300_context *r300,
                 &r300->context, *index_buffer, index_offset,
                 *start, count, ptr);
 
+       *index_buffer = NULL;
         pipe_resource_reference(index_buffer, out_buffer);
         *index_size = 2;
         *start = out_offset / 2;
@@ -59,6 +60,7 @@ void r300_translate_index_buffer(struct r300_context *r300,
                                                 index_offset, *start,
                                                 count, ptr);
 
+           *index_buffer = NULL;
             pipe_resource_reference(index_buffer, out_buffer);
             *start = out_offset / 2;
             r300->validate_buffers = TRUE;
@@ -74,6 +76,7 @@ void r300_translate_index_buffer(struct r300_context *r300,
                                               index_offset, *start,
                                               count, ptr);
 
+           *index_buffer = NULL;
             pipe_resource_reference(index_buffer, out_buffer);
             *start = out_offset / 4;
             r300->validate_buffers = TRUE;