Skip to content
Snippets Groups Projects
Commit e3e99be1 authored by Emma Anholt's avatar Emma Anholt
Browse files

intel: Allow intel_region_reference() with *dst != NULL.


This should help us avoid leaking regions in region reference code by
making the API more predictable.

Reviewed-by: default avatarChad Versace <chad@chad-versace.us>
(cherry picked from commit 036b74a7)
(cherry picked from commit d8f65c07)
parent 5a7d1c97
No related merge requests found
......@@ -264,12 +264,15 @@ intel_region_alloc_for_handle(struct intel_screen *screen,
void
intel_region_reference(struct intel_region **dst, struct intel_region *src)
{
if (src)
_DBG("%s %p %d\n", __FUNCTION__, src, src->refcount);
_DBG("%s: %p(%d) -> %p(%d)\n", __FUNCTION__,
*dst, *dst ? (*dst)->refcount : 0, src, src ? src->refcount : 0);
assert(*dst == NULL);
if (src) {
src->refcount++;
if (src != *dst) {
if (*dst)
intel_region_release(dst);
if (src)
src->refcount++;
*dst = src;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment