Re: GtkBoxed and is_refcounted



On 28 Jun 2001, Owen Taylor wrote:

> 
> Since you asked me to email you something about this -
> 
> GType g_boxed_type_register_static (const gchar   *name,
>                 		    GBoxedInitFunc boxed_init,
> 			            GBoxedCopyFunc boxed_copy,
> 			            GBoxedFreeFunc boxed_free,
> 			            gboolean	   is_refcounted);
> 
> The is_refcounted flag is used for exactly one thing:
> 
>       /* never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types */
>       if (!node->is_refcounted && (collect_flags & G_VALUE_NOCOPY_CONTENTS))
> 	{
> 	  value->data[0].v_pointer = collect_values[0].v_pointer;
> 	  value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
> 	}
> 
> Which doesn't seem that worthwhile - G_VALUE_NOCOPY_CONTENTS has
> to be asked for explicitely; the person has already said:
> 
>  "I've considered reentrancy issues, you don't need to copy/refcount
>   this parameter"
> 
> So it doesn't make sense for me to then say:
> 
>  "Well, this boxed type is refcounted, so I can copy the parameter
>   cheaply, so let me ignore you and do it anyways."
> 
> It's not a huge deal -- but if you think gettting rid of it makes
> sense, I'd be willing to go through and fix the 10-15 places
> where this function is used in glib,pango,gtk+,libgnomeui

i think the issue here were signal emissions. if you specified
G_VALUE_NOCOPY_CONTENTS blindly for every signal arg (actually
there it is G_SIGNAL_TYPE_STATIC_SCOPE) ref-counted boyed types
wouldn't get refcounted while tehy really always should (as objects).
but since G_SIGNAL_TYPE_STATIC_SCOPE is on demand in our API now,
i wonder whether is_refcounted matters as much.

> 
> Regards,
>                                         Owen
> 

---
ciaoTJ





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]