Re: [gtk-list] GTK--: Gtk_Notebook::append_page question
- From: Tero Pulkkinen <terop students cc tut fi>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] GTK--: Gtk_Notebook::append_page question
- Date: 14 Jul 1998 22:03:48 +0300
Ionut Borcoman at home <borco@mailbox.ro> writes:
> I want to add some pages to a notebook. I am using something like this:
>
> frame0.set_usize( 200, 200 );
> frame0.border_width( SPACING );
> notebook.append_page( &frame0,new Gtk_Label("a page"));
> frame0.show();
>
> My question is this:
>
> Will the memory allocated for the label by dealocated corectly when the
> notebook or notebook page is deleted ? Will this kind of declaration
> ("new Gtk_Label("a page")") produce memory leaks ?
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.
This allows you to insert also items which are allocated statically,
or embedded inside other objects to the container.
(There has been talking about making versions of add methods that
transfer ownership, as they might be useful sometimes, but there has
not been need for one yet... => gtk-- containers work like
vector<Gtk_Widget*> would do -- at some point there will be iterators
available too to use STL's algorithms with them when desired.)
--
-- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]