Re: Memory allocation in TreeView and TreeModel



On Saturday 27 March 2004 18:46, Daniel Drake wrote:

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. 

Yes, GtkListStore will make its own copy of any string you pass into a 
G_TYPE_STRING column.


 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 

That's correct as well.

Also see:
http://scentric.net/tutorial/sec-treemodel-data-manipulation.html
http://scentric.net/tutorial/sec-treemodel-data-retrieval.html
and http://scentric.net/tutorial/sec-treemodel-storing-gobjects.html

Cheers
-Tim



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