Commit 1d2dcf80 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

picture_pool: remove unnecessary special case

We can offload the picture deletion to Destroy() in all cases.
parent 293ed5e2
...@@ -209,16 +209,12 @@ void picture_pool_Delete(picture_pool_t *pool) ...@@ -209,16 +209,12 @@ void picture_pool_Delete(picture_pool_t *pool)
assert(!pool->picture_reserved[i]); assert(!pool->picture_reserved[i]);
/* Restore the original garbage collector */ /* Restore the initial reference that was cloberred in
if (atomic_fetch_add(&picture->gc.refcount, 1) == 0) * picture_pool_NewExtended(). */
{ /* Simple case: the picture is not locked, destroy it now. */ atomic_fetch_add(&picture->gc.refcount, 1);
picture->gc.pf_destroy = gc_sys->destroy; /* The picture might still locked and then the G.C. state cannot be
picture->gc.p_sys = gc_sys->destroy_sys; * modified (w/o memory synchronization). */
free(gc_sys); atomic_store(&gc_sys->zombie, true);
}
else /* Intricate case: the picture is still locked and the gc
cannot be modified (w/o memory synchronization). */
atomic_store(&gc_sys->zombie, true);
picture_Release(picture); picture_Release(picture);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment