O Mar, 13-07-2010 ás 09:55 +0200, Joaquim Rocha escribiu: > I think we should go with the way g_utf8_* functions and others are > done: provide a location to store an eventual error (GError **) or > NULL > if error should be ignored. We are speaking about callbacks, not regular async functions, which is a different matter, IMHO, > On Tue, 2010-07-13 at 09:30 +0200, Juan A. Suarez Romero wrote: > > For what I know, standard way is that client must free the error in > the > > callback. But I would like to be sure before digging the code and > making > > sure it is always done in that way. I don't know as I always check the libraries doc for that, but IMHO, it would be better that the framework does that because if the client is not interested in the error, it doesn't need to do anything and in case it does, it can copy if it needs to keep it. If you keep the error without copying it, you can easily get segfault. The other way around, you force the client to free it, so you change the possible segfault for a possible leak (I won't enter to discuss if it is better to have an early segfault than a late leak). With this option it is easier to propagate the error with g_propagate_error. I don't have a strong opinion about this. Br.
Attachment:
signature.asc
Description: This is a digitally signed message part