Bartek Kostrzewa's fix for crash in GMenubar

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13217 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Spray 2006-02-12 16:03:55 +00:00
parent 17cc48720a
commit ed6d4b736f
2 changed files with 17 additions and 6 deletions

View File

@ -1,6 +1,9 @@
2006-02-12 John Spray <spray@lyx.org>
* GMenubar.C: assume backend strings in latin1 (bug 1954)
2006-02-12 Bartek Kostrzewa <bartek@runbox.com>
* GMenubar.C: Fix crash with navigation submenus
2006-02-09 John Spray <spray@lyx.org>
* GPreferences.[Ch], glade/preferences.glade: Add language tab

View File

@ -142,18 +142,26 @@ void GMenubar::onSubMenuActivate(MenuItem const * item,
ClearMenu(gmenu);
LyxMenu * lyxmenu = static_cast<LyxMenu*>(gmenu);
lyxmenu->clearBackMenu();
Menu * fmenu = item->submenuname().empty() ?
item->submenu() :
&menubackend.getMenu(item->submenuname());
Menu * fmenu;
Menu::const_iterator i;
Menu::const_iterator end;
if(!item->submenuname().empty()) {
fmenu = &menubackend.getMenu(item->submenuname());
menubackend.expand(*fmenu, lyxmenu->getBackMenu(), view_);
i = lyxmenu->getBackMenu().begin();
end = lyxmenu->getBackMenu().end();
} else {
fmenu = item->submenu();
i = fmenu->begin();
end = fmenu->end();
}
// Choose size for icons on command items
int iconwidth = 16;
int iconheight = 16;
Gtk::IconSize::lookup(Gtk::ICON_SIZE_MENU, iconwidth, iconheight);
menubackend.expand(*fmenu, lyxmenu->getBackMenu(), view_);
Menu::const_iterator i = lyxmenu->getBackMenu().begin();
Menu::const_iterator end = lyxmenu->getBackMenu().end();
Gtk::Menu * gmenu_new;
for (; i != end; ++i) {
switch (i->kind()) {