Re: gtk_tree_model_get() --> when to free results???



On 05/10/2005 09:40:04 AM, Olivier Sessink wrote:
Hi all,

in the documentation from gtk_tree_model_get() at http://developer.gnome.org/doc/API/2.0/gtk/ GtkTreeModel.html#gtk-tree-model-get I read: "If appropriate, the returned values have to be freed or unreferenced."

my question is: when is it appropriate?

I expect the model always to return the same pointer I used to fill the model.

If the column is G_TYPE_POINTER, that's correct. If it's G_TYPE_OBJECT or a type that inherits from it, you get the original pointer, but with an extra reference that should be removed when you're done with it. If it's G_TYPE_STRING, you get a newly allocated copy of the string, which you should free when you're done with it. Dunno about boxed...



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