[pulseaudio-discuss] [PATCH] memblock: multiple references should make blocks read-only

Tanu Kaskinen tanuk at iki.fi
Thu Apr 6 20:35:13 UTC 2017


On Thu, 2017-04-06 at 20:02 +0200, Georg Chini wrote:
> On 08.06.2016 20:18, Tanu Kaskinen wrote:
> > The old code makes no sense to me. Why would multiple references mean
> > that a previously read-only memblock is suddenly writable? I'm pretty
> > sure that the original intention was to treat multi-referenced blocks
> > as read-only. I don't have any examples where the old code would have
> > caused bad behaviour, however.
> > ---
> >   src/pulsecore/memblock.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c
> > index 17520ed..babe5cd 100644
> > --- a/src/pulsecore/memblock.c
> > +++ b/src/pulsecore/memblock.c
> > @@ -497,7 +497,7 @@ bool pa_memblock_is_read_only(pa_memblock *b) {
> >       pa_assert(b);
> >       pa_assert(PA_REFCNT_VALUE(b) > 0);
> >   
> > -    return b->read_only && PA_REFCNT_VALUE(b) == 1;
> > +    return b->read_only || PA_REFCNT_VALUE(b) > 1;
> >   }
> >   
> >   /* No lock necessary */
> 
> Arun already acknowledged that patch, looks like you forgot
> to push it.

Thanks, I probably didn't notice Arun's mail at all (it's marked as
unread).

-- 
Tanu

https://www.patreon.com/tanuk


More information about the pulseaudio-discuss mailing list