Re: [gtk-list] Re: GTK--: Gtk_Notebook::append_page question



Tero Pulkkinen <terop@students.cc.tut.fi> writes:

> > > With all gtk-- containers, including notebooks, the ownership of the
> > > items inserted to it are NOT transferred to the container. Thus you
> > > must delete everything yourself what you allocate.
> 
> Ionut Borcoman at home <borco@mailbox.ro> writes:
> > Than my style of appending is not good. :( And I have to keep a lot of
> > variables, otherwise not needed. The biggest problem is how to name all
> > this bunch of widgets ! :)
> > 
> > And it means that the piece of code from bellow is also leaving some
> > memory that cannot be freed, isn't it ?
> 
> Yuup.

An alternative solution is, when you want to destroy the container, to 
call Gtk_Container::children() which will return a GList* (soon a
G_List*) of all the children, then iterate on it to delete them.

Note that you'll also have to delete the list itself, since it's built
on the fly from the internal data of the container,
gtk_container_children() is not a mere accessor.

-- 
					Guillaume.
					http://www.worldnet.fr/~glaurent



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