]> git.sesse.net Git - vlc/commitdiff
picture_pool: remove unnecessary special case
authorRémi Denis-Courmont <remi@remlab.net>
Mon, 27 Oct 2014 19:05:00 +0000 (21:05 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Wed, 29 Oct 2014 19:27:49 +0000 (21:27 +0200)
We can offload the picture deletion to Destroy() in all cases.

src/misc/picture_pool.c

index 294d671eedbf9b027775fd2c61ee0b38b6199ad9..86b30ac9fcbe0b8d60b591e2e46f0b9c158c6417 100644 (file)
@@ -209,16 +209,12 @@ void picture_pool_Delete(picture_pool_t *pool)
 
             assert(!pool->picture_reserved[i]);
 
-            /* Restore the original garbage collector */
-            if (atomic_fetch_add(&picture->gc.refcount, 1) == 0)
-            {   /* Simple case: the picture is not locked, destroy it now. */
-                picture->gc.pf_destroy = gc_sys->destroy;
-                picture->gc.p_sys      = gc_sys->destroy_sys;
-                free(gc_sys);
-            }
-            else /* Intricate case: the picture is still locked and the gc
-                    cannot be modified (w/o memory synchronization). */
-                atomic_store(&gc_sys->zombie, true);
+            /* Restore the initial reference that was cloberred in
+             * picture_pool_NewExtended(). */
+            atomic_fetch_add(&picture->gc.refcount, 1);
+            /* The picture might still locked and then the G.C. state cannot be
+             * modified (w/o memory synchronization). */
+            atomic_store(&gc_sys->zombie, true);
 
             picture_Release(picture);
         }