After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 94941 - Segfault with menus and inheritance
Segfault with menus and inheritance
Status: RESOLVED NOTABUG
Product: gtkmm
Classification: Bindings
Component: general
2.0
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2002-10-05 14:43 UTC by Peter De Wachter
Modified: 2015-08-14 11:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Peter De Wachter 2002-10-05 14:43:24 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.
Comment 1 Murray Cumming 2002-10-09 09:05:48 UTC
Please see the FAQ entry about dynamic_cast.