In region_unmap(), check if region is mapped before decrementing refcount.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user