mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 01:20:17 +01:00
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: Chad Versace <chad@chad-versace.us>
This commit is contained in:
parent
86e62b2357
commit
036b74a7f8
1 changed files with 6 additions and 4 deletions
|
|
@ -264,11 +264,13 @@ 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);
|
||||
|
||||
if (src != *dst) {
|
||||
if (*dst)
|
||||
intel_region_release(dst);
|
||||
|
||||
assert(*dst == NULL);
|
||||
if (src) {
|
||||
src->refcount++;
|
||||
*dst = src;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue