- From: Murray Cumming <murrayc murrayc com>
- To: Antonio Coralles <noche suapie reflex at>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: Gtk::manage
- Date: Wed, 20 Jul 2005 00:45:23 +0200
On Tue, 2005-07-19 at 21:57 +0200, Antonio Coralles wrote:
> I did not use Gtk::manage(...) until now. However, i knew it was there,
> and today i thought it could come in very handy in a particular coding
> task. What i do, stripped to the bare minimum is this: I have a two
> classes, basically of type Gtk::Bin, call them Bin1 (a Gtk::Frame),
> Bin2 (derived from Gtk::ScrolledWindow) and a method of another class,
> lets say 'void AnotherClass ::something()'.
> void AnotherClass::something()
> Bin1* p_bin1 = getBin1();
> Bin2* p_bin2 = Gtk::manage(new Bin2);
> I thought that through calling p_bin1->remove(), the old object, stored
> in p_bin1 should be deleted.
No, remove() is not meant to delete your object. That would be awkard if
you wanted to just remove() it before adding() it somewhere else. Use
delete to delete.
> However, as my 'Bin2 class' allocates about
> 3MB, i can see clearly in the system monitor, that this doesn't happen.
> You might guess, that my destructor for Bin2 is not virtual - but this
> is not true. Besides, i was able to stuff this leak by switching to my
> own memory management, which was, thanks to boost::scoped_array and
> boost::scoped_ptr not that difficult.
> So may question is: Did i try somthing which was not intended with
> Gtk::manage, or did i discover a bug ?
> I'm using gtkmm-2.6.3.
> gtkmm-list mailing list
> gtkmm-list gnome org
murrayc murrayc com
] [Thread Prev