Re: deleting derived widget?



On Wed, 2006-02-22 at 22:11 +0100, klaus triendl wrote:
> On Son, 2006-02-19 at 22:49 +0100, Murray Cumming wrote:
> > On Sun, 2006-02-19 at 21:35 +0000, Chris Vine wrote:
> > > gtkmm's memory management is not the same as GTK+'s.  In gtkmm, generally you 
> > > have to call manage() on the widget for it to be owned by its container.  
> > > Whether that also applies to glademm I do not know.
> > 
> > glademm is not libglademm.
> > 
> > When using libglademm, the memory management is like so:
> > http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch20s02.html
> > (it does the manage() for you.)
> > 
> > Possibly that's a bit inconsistent compared to doing a regular new(),
> > but we didn't know how libglade worked when we first created the API,
> > and it's not so bad.
> 
> 
> Sorry, I was away for some days..
> 
> by the way: the link is not right (also on the website [memory
> management and libglademm); the chapter about derived widgets is now at
> http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch19s03.html
> 
> If libglademm does the manage() for me then this would be great.
> What I still don't understand is why the destructor of the derived
> widget (managed by libglademm according to Murray) is not called when
> the program ends.

Because the dialog is never deleted. You must delete windows yourself,
because Windows can not be manage()ed, because manage() is for child
widgets. I will correct the example in CVS.

> You can try this out very easily by writing something to the console in
> the dtor of the dialog widget when testing the "derived" example. This
> doesn't seem sane to me thinking in c++.
> So my question is still whether I'm responsible to delete at least the
> top-level widget or not.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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