[vlc-devel] commit: Do not increase refcount when the release callback is not present. (Laurent Aimar )
pdherbemont at free.fr
Thu Jul 17 23:55:52 CEST 2008
On Jul 17, 2008, at 11:34 PM, Laurent Aimar wrote:
> On Thu, Jul 17, 2008, Pierre d'Herbemont wrote:
>> On Jul 17, 2008, at 10:43 PM, git version control wrote:
>>> vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Thu Jul
>>> 17 22:45:03 2008 +0200| [76ab4696aa1dd14a349a7492faf4f93ddb13cbfc]
>>> Do not increase refcount when the release callback is not present.
>>> src/misc/image.c | 9 ++++++---
>>> 1 files changed, 6 insertions(+), 3 deletions(-)
>>> diff --git a/src/misc/image.c b/src/misc/image.c
>>> index 4fc679a..3117ce4 100644
>>> --- a/src/misc/image.c
>>> +++ b/src/misc/image.c
>>> @@ -316,7 +316,8 @@ static block_t *ImageWrite( image_handler_t
>>> *p_image, picture_t *p_pic,
>>> p_image->p_filter->fmt_out.video = p_image->p_enc-
>>> - p_pic->i_refcount++; /* pf_video_filter() will call
>>> pf_release() */
>>> + if( p_pic->pf_release )
>>> + p_pic->i_refcount++;
>> Yet an other candid comment, why don't we use vlc_pic_incref() or
>> vlc_gc_incref() and so on here?
> Because vlc_pic_incref does not exit (and should probably be called
> to be consistant with vlc_object_t).
> And because vlc_gc_incref is not applicable here as pf_release is
> called every time
> (it is not a destructor)...
oh... I missed that.
> So unless I overlooked and missed the obvious, I will clean up by
> introducing a
> few helpers for picture..
Would be nice I think.
Thanks for the feedback,
More information about the vlc-devel