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> 2006-02-12 John Spray <spray@lyx.org>
* GMenubar.C: assume backend strings in latin1 (bug 1954) * 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> 2006-02-09 John Spray <spray@lyx.org>
* GPreferences.[Ch], glade/preferences.glade: Add language tab * GPreferences.[Ch], glade/preferences.glade: Add language tab

View File

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