Re: Gtk window.show() (maybe just c++ related)



Am Samstag, den 02.12.2006, 12:58 +0100 schrieb eric jrdn2:

> >>>       
> >> Thank you, the assumptions you made are right. Another newbie question:
> >> Should I call delete() on each widget created with new() inside this 
> >> widget1, or will widget1 do it itself when it will die?
> >> Sorry for such a lame understanding of c++ :-)
> >>     
> >
> >
> > You sent this message to my private e-mail address. Please re-send it to
> > gtkmm-list gnome org
> >
> > Maik

> >   
> I did a reply to all, it is on the list too.
> Eric
> 

Sorry for this, evolution seems to play tricks on me ;)

Your question on calling delete or not isn't C++ specific, but framework
specific. If you want this framework, Gtkmm , to manage your heap object
you write:

foo* foo_ptr = Gtk::manage(new foo() );
bar_container->add(*foo_ptr);

When bar_container is destroyed the object foo_ptr pointed to will be
destroyed too. If you just do

foo* foo_ptr = new foo() ;
bar_container->add(*foo_ptr);

you have to save foo_ptr and call delete on it before your app ends.

MfG Maik  




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