Re: Doubt about free or dont free



Arx Henrique wrote:

my doubt is g_free or not g_free the text?

When in doubt, read API docs:

Tks x)
next time i'll read api

While the case of returned "const gchar *"s is rather simple, the real
problem to me is that the API docs are quite less explicit when it comes
to more complex objects than just string constants.

For instance, whether and how reference counts of objects related to
treeviews are changed by what GTK+ functions dealing with them remains
undocumented.

For instance: whether gtk_tree_view_set_model() changes the reference
counts of either the newly set or the replaced GtkTreeModel remains as
unclear as whether gtk_tree_view_get_selection() increases the reference
count of the selection object or not.

If I remember right the first function changes reference counts while
the 2nd one doesn't but I may be wrong on this. Frequent explicit checks
on object reference counts after many GTK+ functions are my only way to
make sure about this while developping.

I wish the API docs would be added a line for _every_ get- or set-
function, which explicitly notes whether and how reference counts of
associated objects are changed by that function.



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