[gtkmm] Destroying menu
- From: "Andrew E. Makeev" <andrew solvo ru>
- To: gtkmm-main <gtkmm-list gnome org>
- Subject: [gtkmm] Destroying menu
- Date: Mon, 24 Feb 2003 17:13:43 +0300
Hi.
I would to introduce some feature that I've just discovered.
I guess, it should be mentioned somewhere in FAQs, either in ChangeLog,
but I've missed it somehow (probably, not only me).
I am using menu bar with menu items that could contain submenus. The
rule is I have to destroy it very careful, starting with last-last
submenu in certain menu. Sample:
[tools ]
| add > |
My menubar class contains following members:
class MainMenu : public Gtk::MenuBar
{
Gtk::Menu m_MenuTools; // this is
Gtk::Menu m_MenuAdd; // right
public:
MainMenu ()
{
...
m_MenuTools.items ().push_back (MenuElem ("Add", m_MenuAdd));
...
}
~MainMenu ();
};
class MainMenu : public Gtk::MenuBar
{
Gtk::Menu m_MenuAdd; // this is
Gtk::Menu m_MenuTools; // wrong
public:
MainMenu ()
{
...
m_MenuTools.items ().push_back (MenuElem ("Add", m_MenuAdd));
...
}
~MainMenu ();
};
In second case, m_MenuTools gonna be destroyed first, and it will
automatically destroy it's children, so, when MainMenu D-TOR would
attempt to destroy m_MenuAdd it will segfault.
Well, like I said I'd accept it as feature GTK, and just going to warn
people be careful when handling menus in GTKMM.
Regards,
-andrew
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]