In region_unmap(), check if region is mapped before decrementing refcount.

This commit is contained in:
Brian 2007-10-20 15:45:24 -06:00
parent bb3d61551c
commit 7c8b2f7ce3
2 changed files with 14 additions and 8 deletions

View file

@ -59,10 +59,13 @@ i915_region_unmap(struct pipe_context *pipe, struct pipe_region *region)
{
struct i915_context *i915 = i915_context( pipe );
if (!--region->map_refcount) {
i915->pipe.winsys->buffer_unmap( i915->pipe.winsys,
region->buffer );
region->map = NULL;
if (region->map_refcount > 0) {
assert(region->map);
if (!--region->map_refcount) {
i915->pipe.winsys->buffer_unmap( i915->pipe.winsys,
region->buffer );
region->map = NULL;
}
}
}

View file

@ -69,10 +69,13 @@ sp_region_unmap(struct pipe_context *pipe, struct pipe_region *region)
{
struct softpipe_context *sp = softpipe_context( pipe );
if (!--region->map_refcount) {
sp->pipe.winsys->buffer_unmap( sp->pipe.winsys,
region->buffer );
region->map = NULL;
if (region->map_refcount > 0) {
assert(region->map);
if (!--region->map_refcount) {
sp->pipe.winsys->buffer_unmap( sp->pipe.winsys,
region->buffer );
region->map = NULL;
}
}
}