GNOME Bugzilla – Bug 95749
managed child widgets destroyed when removed.
Last modified: 2004-12-22 21:47:04 UTC
I have a class: class MyFrame : public Gtk::Frame { public: MyFrame(string s) : Gtk::Frame(s), b(s) { add(b); } virtual ~MyFrame() { cout << "MyFrame dtor" << endl; } private: Gtk::Button b; }; when it is erased from a vbox using: vbox1.children().erase(vbox1.children().begin(), vbox1.children().end()); the destructor does not get called (see attached file test1.cc). If b is a pointer (test2.cc) and I use manage in the ctor the dtor gets called when I use vbox.chlidren().erase()... This bug (if it is a bug?) appeard first in gtkmm-1.3.24.
Created attachment 11533 [details] test program #1
Created attachment 11534 [details] test case #2
This is quite well-known behaviour, but it would be nice to prevent it.
2002-10-21 Murray Cumming <murrayc@usa.net> * Gtk::Container_Class:destroy_callback(): dynamic_cast<> child widgets to Widget*, instead of Container*, of course. This seems to fix lots of lifetime bugs.