Gtk::manage



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();
       p_bin1->remove();
      
       Bin2* p_bin2 = Gtk::manage(new Bin2);
       p_bin1->add(*p_bin2);
}

I thought that through calling p_bin1->remove(), the old object, stored
in p_bin1 should be deleted. 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.
Antonio



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