GtkBoxed and is_refcounted



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

Regards,
                                        Owen






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