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

Re: Why is there no gtk_window_free() ?



On Mon, 2009-03-23 at 09:49 +0000, John Emmas wrote:
> Does gtk_window_new() allocate any system memory?  I've always assumed
> so - and yet whenever I see examples of gtk_window_new() in use, the
> returned pointer is never freed anywhere, which suggests that no memory was
> ever allocated.  Which is right?

A GtkWindow is also a GtkWidget, and looking at the reference
documentation
http://library.gnome.org/devel/gtk/stable/GtkWidget.html#gtk-widget-destroy you can use gtk_widget_destroy() on a window to decrease its reference count by one. When this reference count reaches 0, the widget is finalized and its resources returned to the system. This technique is applicable to all objects that inherit from GtkWidget.

This reference-counting system is based on GObject, which has some nice
reference documentation at
http://library.gnome.org/devel/gobject/unstable/gobject-memory.html if
you want to read further.

--
David King | http://amigadave.blogspot.com/ | davidk openismus com



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