Memory allocation in TreeView and TreeModel



Hi,

I'm asking this for clarification as much as anything else.

I have previously been writing strings into G_TYPE_STRING columns of a GtkListStore (using gtk_list_store_set) and assuming that GTK will use the already-allocated strings in the tree.

I now have a suspicion that GTK is actually copying these strings and using its own copies in the list model. So if appropriate, I should be freeing my original strings after writing them using gtk_list_store_set. Can anyone confirm this?

From a basic code-test, I am also under the impression that when using gtk_tree_model_get on a G_TYPE_STRING column, the string returned will be a copy of the string used internally for the tree model - and therefore I should free it once I'm done with it. I'd be grateful for confirmation on this point too.

Thanks,

Daniel



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