Re: freeing GTK+ memory
- From: Pablo Yanez Trujillo <yanezp informatik uni-freiburg de>
- To: Chris Vine <chris cvine freeserve co uk>
- Cc: gtk-list gnome org
- Subject: Re: freeing GTK+ memory
- Date: Sat, 18 Oct 2008 00:00:01 +0200
-----BEGIN PGP SIGNED MESSAGE-----
thanks, that's what I wanted to know. But I have some more questions:
1. Does the behaviour (about 'floating' references) also apply for (gtk+) objects created with g_object_new instead of
2. The GtkObject documentation says: "Never call g_object_unref() unless you have previously called g_object_ref() ..",
however in the "HelloWorld" example of the TreeView tutorial  Tim writes:
model = create_and_fill_model (); /* function creates a ListStore with gtk_list_store_new */
gtk_tree_view_set_model (GTK_TREE_VIEW (view), model);
/* The tree view has acquired its own reference to the
* model, so we can drop ours. That way the model will
* be freed automatically when the tree view is destroyed */
Is this correct? Or it is safe to do so since gtk_tree_view_set_model implicit g_object_ref() call?
Is there a document(ation) which describes more precisely how Gtk+/Glib manages the memory of the objects (I mean about
those 'floating' references, etc)?
Pablo Yánez Trujillo
My public key: http://klingsor.informatik.uni-freiburg.de/gpg/supertux.asc
Chris Vine wrote:
> On Fri, 17 Oct 2008 01:48:18 +0200
> Pablo Yanez Trujillo <yanezp informatik uni-freiburg de> wrote:
>> One question remains unanswered though: if I use gtk_widget_destroy
>> then the memory for this widget (and children if they exist) will be
>> (automatically) freed by Gtk/Glib? Sometimes you really want to
>> destroy a window/widget/whatever you don't need anymore.
> This does not apply to pure GObjects not derived from GInitiallyUnowned.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
-----END PGP SIGNATURE-----
] [Thread Prev