Yeah, I got to wonder about this one too. There was code expecting to own a 
reference when manipulating STRINGSHARE. The alternative was maybe to do the 
ref on the other side. The only other case where a get like that could 
potentially return a ref is EINA_VALUE_TYPE_OBJECT, but we don't do it there. 
If you think it is best to not ref, I will fix this the other way around.

On May 2, 2018 7:33 AM, Gustavo Sverzut Barbieri <[email protected]> wrote:
> this doesn't look right, we don't ref in other cases...
> 
> On Tue, May 1, 2018 at 2:40 PM, Cedric BAIL [email protected] wrote:
> > cedric pushed a commit to branch master.
> >
> > http://git.enlightenment.org/core/efl.git/commit/?id=b1883c7989355e95cd4c826d3c7ecdbbbd257d77
> > 
> > commit b1883c7989355e95cd4c826d3c7ecdbbbd257d77
> > Author: Cedric BAIL [email protected]
> > Date: Fri Apr 27 16:19:42 2018 -0700
> > 
> >     eina: make eina_value_pget on an EINA_VALUE_TYPE_STRINGSHARE return a 
> > new reference to a stringshare.
> > ---
> > src/lib/eina/eina_value.c | 12 +++++++++++-
> > 1 file changed, 11 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/lib/eina/eina_value.c b/src/lib/eina/eina_value.c
> > index cb5fbc11c4..ddb02af48d 100644
> > --- a/src/lib/eina/eina_value.c
> > +++ b/src/lib/eina/eina_value.c
> > @@ -2225,6 +2225,16 @@ _eina_value_type_stringshare_pset(const 
> > Eina_Value_Type *type EINA_UNUSED, void
> > }
> > 
> > static Eina_Bool
> > +_eina_value_type_stringshare_pget(const Eina_Value_Type *type EINA_UNUSED, 
> > const void *mem, void *ptr)
> > +{
> > +   const Eina_Stringshare * const *src = mem;
> > +   Eina_Stringshare **dst = ptr;
> > +   
> > +   *dst = eina_stringshare_ref(*src);
> > +   return EINA_TRUE;
> > +}
> > +  
> > +static Eina_Bool
> > _eina_value_type_string_flush(const Eina_Value_Type *type EINA_UNUSED, void 
> > *mem)
> > {
> >   char *tmem = mem;
> >@@ -5197,7 +5207,7 @@ static const Eina_Value_Type _EINA_VALUE_TYPE_BASICS[] 
> >= {
> >     NULL, / no convert from */
> >     _eina_value_type_stringshare_vset,
> >     _eina_value_type_stringshare_pset,
> > -   _eina_value_type_string_common_pget
> > +  _eina_value_type_stringshare_pget
> >     },
> >     {
> >     EINA_VALUE_TYPE_VERSION,


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to