Re: Freeing gerrors



On Tue, 2010-07-13 at 09:55 +0200, Joaquim Rocha wrote:
> 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.


Sorry, I think you didn't get my point.


My question is that in a callback, where last parameter is an error, who
should be in charge of freeing that error? The callback caller? Or the
callback itself?

Here is an example:

static void
my_callback(..., GError *error)
{
  if (error) {
    g_print ("error: %s\n", error->message);
    /* Should I free error here? Or is a caller duty? */
  }
}

main()
{
  process_my_request(..., my_callback);
}


	J.A.




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