where to use a g_free ?



I am slightly confused by some (er, at least one) of the examples I've
seen in the
archives: they seem to suggest that a structure defined within a
function
(so as to be able to pass  more than one widget to a callback for
example)
needs to give up its memory through a  g_free statement at the end of
the _function_  itself .
This confuses me because regardless of whether the callback is called or
not,
one ends up freeing the memory anyway (thereby causing a crash) when the
program
execution reaches the end of the function.  Perhaps an alternative is to
write another
_callback_ so that g_free is called before the dialog in question
destroys itself but
introducing another callback doesn't seem like a very elegant
solution...

Thanks for any help,

Cevat Ustun.





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