fix gmenubar crash on "Figures" submenu

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9039 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Spray 2004-10-04 11:32:34 +00:00
parent 041474d127
commit dec1f2fd28
2 changed files with 15 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2004-10-04 John Spray <spray_john@users.sourceforge.net>
* GMenubar.C: use item->submenu() instead of
getMenu(item->submenuname) where item->submenuname is empty.
Fixes crash with "Figures" submenu.
2004-10-03 John Spray <spray_john@users.sourceforge.net>
* GMenubar.C: add labels in MenuItems to display bindings

View File

@ -124,9 +124,9 @@ void GMenubar::openByName(string const & name)
bool GMenubar::submenuDisabled(MenuItem const * item)
{
Menu & from = menubackend.getMenu(item->submenuname());
Menu * from = item->submenu();
Menu to;
menubackend.expand(from, to, view_);
menubackend.expand(*from, to, view_);
Menu::const_iterator i = to.begin();
Menu::const_iterator end = to.end();
for (; i != end; ++i) {
@ -158,7 +158,10 @@ void GMenubar::onSubMenuActivate(MenuItem const * item,
ClearMenu(gmenu);
LyxMenu * lyxmenu = static_cast<LyxMenu*>(gmenu);
lyxmenu->clearBackMenu();
Menu * fmenu = &menubackend.getMenu(item->submenuname());
Menu * fmenu = item->submenuname().empty() ?
item->submenu() :
&menubackend.getMenu(item->submenuname());
menubackend.expand(*fmenu, lyxmenu->getBackMenu(), view_);
Menu::const_iterator i = lyxmenu->getBackMenu().begin();
Menu::const_iterator end = lyxmenu->getBackMenu().end();