Re: Comments on 95362 (tree dnd) patch



On Fri, 2003-09-05 at 16:14, Matthias Clasen wrote:
> Am Fre, 2003-09-05 um 21.48 schrieb Owen Taylor:
> 
> > Two tiny comments from browsing the path.
> > 
> > ===
> > +static void
> > +dest_row_free (gpointer data)
> > +{
> > +  DestRow *dr = (DestRow *)data;
> > +
> > +  if (!dr)
> > +    return;
> > ==
> > 
> > This isn't right - free functions never get NULL passed to them.
> > 
> 
> Really ? The fact that g_free() silently accepts NULL is documented and
> widely used behaviour.

Not talking about that sort of free function, what I meant was we have:

===
void
g_datalist_id_set_data_full (GData        **datalist,
                             GQuark         key_id,
                             gpointer       data,
                             GDestroyNotify destroy_func)
{
  g_return_if_fail (datalist != NULL);
  if (!data)
    g_return_if_fail (destroy_func == NULL);
===

So, if you do g_object_set_data_full(), it's not possible for
your GDestroyNotify to be called with NULL for the data.

Regards,
						Owen





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