GNOME Bugzilla – Bug 94941
Segfault with menus and inheritance
Last modified: 2015-08-14 11:47:12 UTC
The following program segfaults with gtkmm 1.3.23: #include <gtkmm.h> class WindowWithMenuBar: public Gtk::Window { public: Gtk::MenuBar menubar_; WindowWithMenuBar () { add(menubar_); } }; class AnotherWindow: public WindowWithMenuBar { public: Gtk::Menu menu_foo_; AnotherWindow () { menubar_.items().push_back( Gtk::Menu_Helpers::MenuElem("Foo", menu_foo_)); } }; int main (int argc, char *argv[]) { Gtk::Main kit(argc, argv); AnotherWindow w; kit.run(w); } This program runs without problems if you combine the two classes.
Please see the FAQ entry about dynamic_cast.