Web lists-archives.com

Re: g_error_free() warning on null pointer




Emmanuele Bassi wrote:
> > Michael McConville wrote:
> >> I wasn't suggesting that it's officially specified. I just think
> >> that this aspect of free() is intentional and useful, and that people
> >> have a reasonable expectation that g_error_free() will conform.
> 
> No, "people" don't have a reasonable expectation. Otherwise we would
> have had many bugs about this, or many other email threads in the past
> 20 years. Please, don't try to generalise your issues.

I doubt they bother. I was annoyed by these console warnings for five
months but never bothered to look into it until I had to rework a number
of GError uses. Other Pidgin developers were also surprised by this.

> You expected the *_free() functions in GLib to be NULL-safe. They
> aren't, except for g_free().

g_error_free is. Maybe others too, I haven't checked. It just prints
annoying console warnings. This really isn't a big deal - it's strange
that some are being so political about it.

> There is no explicit need to make them
> NULL-safe, nor expectation of functionality. To be fair, a lot of
> people to this day do not know that free() is NULL-safe; the amount of
> code I've personally seen over the past 15 years that does:
> 
>   if (foo)
>     free (foo);
> 
> is staggering.

Agreed, a lot of people don't know about free being NULL-safe. A lot of
people do, though.
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-devel-list