Re: Memory allocation in TreeView and TreeModel
- From: "Nils O." Selåsdal <noselasd frisurf no>
- To: gtk-app-devel-list gnome org
- Subject: Re: Memory allocation in TreeView and TreeModel
- Date: Mon, 29 Mar 2004 09:10:21 +0200
On Sat, 2004-03-27 at 19:46, Daniel Drake wrote:
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?
It will be a copy.
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.
Yes, that will also be a copy. free it.
If this copying is undesired, you could use G_TYPE_POINTER
--
Nils O. Selåsdal <noselasd frisurf no>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]