Re: g_free() vs gtk_widget_destroy()
- From: rob <mailingLists pangolin org uk>
- To: Fabio Zanetta <znt fabio virgilio it>
- Cc: gtk list <gtk-app-devel-list gnome org>
- Subject: Re: g_free() vs gtk_widget_destroy()
- Date: 25 Nov 2002 13:19:53 +0000
On Sun, 2002-11-24 at 11:39, Fabio Zanetta wrote:
Hi,
I cannot understand the difference between g_free() and
gtk_widget_destroy().
g_free() frees memory e.g something created with g_malloc() or with one
of the string functions such a g_strdup().
gtk_widget_destroy() forces a widget to be destroyed this means it will
clean up any resources it is using in a nice way, notify any thing thats
interested that it is being desroyed etc. then call free on its self to
free the memory that it's using. Never use g_free() on a widget.
Someone can tell me this?
(btw: I have always to call gtk_widget_destroy()? I see for example
that in
the Hello World in the GTK tutorial it is not used.)
You should never really have to use gtk_widget_destroy().
You should use gtk_widget_unref() (or g_object_unref in gtk2).
With gtk_widget_destroy() the widget is destroyed imedatly.
With gtk_widget_unref() the widget is destroyed only if nothing else
needs it.
You should hardly ever have to worry about this as when you remove a
widget from a container it gets unrefd for you and if a container is
destroyed it first unrefs all it's child widgets.
hope this helps.
Thanx.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
--
rob <rob pangolin org uk>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]