fix invalid usage of buffer_unreference()
authorBrian <brian.paul@tungstengraphics.com>
Sat, 11 Aug 2007 16:03:51 +0000 (17:03 +0100)
committerBrian <brian.paul@tungstengraphics.com>
Sat, 11 Aug 2007 16:03:51 +0000 (17:03 +0100)
Need to pass the address of the buffer ptr, not the buffer ptr.
Before, the region->buffer type was void * so it wasn't effectively
type-checked.  Changing the type to pipe_buffer_object* allows the
compiler to detect the error.  Fixing this solves a segfault.

src/mesa/pipe/i915simple/i915_regions.c
src/mesa/pipe/softpipe/sp_region.c

index 9b7cddb58dc0fcc8d747b05c0ee2077dc7edbd3e..e27443a58c04e62e1072c1df11f2ed00db3af7a3 100644 (file)
@@ -124,7 +124,7 @@ i915_region_release(struct pipe_context *pipe, struct pipe_region **region)
       assert((*region)->map_refcount == 0);
 
       i915->pipe.winsys->buffer_unreference( i915->pipe.winsys,
-                                            (*region)->buffer );
+                                            &((*region)->buffer) );
       free(*region);
    }
    *region = NULL;
index 115f3ab82609d54c2893334160dc03a3ecb19d3b..10b7479e9754fa9353346ec5ffd584927cbce367 100644 (file)
@@ -119,7 +119,7 @@ sp_region_release(struct pipe_context *pipe, struct pipe_region **region)
       assert((*region)->map_refcount == 0);
 
       sp->pipe.winsys->buffer_unreference( sp->pipe.winsys,
-                                     (*region)->buffer );
+                                           &((*region)->buffer) );
       free(*region);
    }
    *region = NULL;