[vlc-devel] [PATCH v3 06/12] picture: do not allow NULL destroy callbacks in picture_NewFromResource

Steve Lhomme robux4 at ycbcr.xyz
Tue Aug 18 08:24:47 CEST 2020


If you don't need a callback just use NULL and set p_sys manually.
---
 src/misc/picture.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/misc/picture.c b/src/misc/picture.c
index 4ccd79d6d15..009bb38b75a 100644
--- a/src/misc/picture.c
+++ b/src/misc/picture.c
@@ -218,11 +218,8 @@ static bool picture_InitPrivate(const video_format_t *restrict p_fmt,
     else
     {
         p_picture->p_sys = p_resource->p_sys;
-
-        if( p_resource->pf_destroy != NULL )
-            priv->gc.destroy = p_resource->pf_destroy;
-        else
-            priv->gc.destroy = picture_DestroyDummy;
+        priv->gc.opaque  = p_resource->p_sys;
+        priv->gc.destroy = p_resource->pf_destroy;
     }
 
     return true;
-- 
2.26.2



More information about the vlc-devel mailing list