Re: [[gtkmm] Destroying menu]



This looks similar to the OptionMenu bug listed here:
http://www.gtkmm.org/bugs.shtml

Maybe you should add a bug. Segfaults are bugs, not features.

"Andrew E. Makeev" <andrew solvo ru> wrote:
> 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
> 
> 
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list



Murray Cumming
murrayc usa net
www.murrayc.com




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