Re: freeing GTK+ memory

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

 



-----BEGIN PGP SIGNED MESSAGE-----Hash: SHA1
> See> http://library.gnome.org/devel/gtk/stable/GtkObject.html#GtkObject.description
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 ofgtk_object_new?
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 [1] Tim writes:
  GtkTreeModel        *model;
  ...
  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 */
  g_object_unref (model);...
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 aboutthose 'floating' references, etc)?
Thanks
RegardsPablo


[1] http://scentric.net/tutorial/ch-treeview.html#sec-TreeView-HelloWorld
Pablo Yánez Trujillohttp://klingsor.informatik.uni-freiburg.de/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@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:> [snip]>> 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.> > See> http://library.gnome.org/devel/gtk/stable/GtkObject.html#GtkObject.description > > This does not apply to pure GObjects not derived from GInitiallyUnowned.> > Chris> -----BEGIN PGP SIGNATURE-----Version: GnuPG v2.0.9 (GNU/Linux)
iEYEARECAAYFAkj5CuAACgkQDzf8xo+0xRVAcgCgk5lLwCUE/6a7awCp4THtpc9gqakAoKI0mhdtQXpRN/D2PPw3L1Yy3mg4=x5gw-----END PGP SIGNATURE-----_______________________________________________gtk-list mailing listgtk-list@xxxxxxxxxxxxx://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux