Fix a crash when applying the preferences.

The problem is that all toolbars are deleted and thus also the LayoutBox, which I made a member of GuiView. 

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31051 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-08-15 14:34:00 +00:00
parent 3c91fecb61
commit ffea0ce1e9

View File

@ -296,8 +296,6 @@ GuiView::GuiView(int id)
// GuiToolbars *must* be initialised before the menu bar. // GuiToolbars *must* be initialised before the menu bar.
normalSizedIcons(); // at least on Mac the default is 32 otherwise, which is huge normalSizedIcons(); // at least on Mac the default is 32 otherwise, which is huge
constructToolbars(); constructToolbars();
d.layout_ = new LayoutBox(*this);
d.stack_widget_->addWidget(d.layout_);
// set ourself as the current view. This is needed for the menu bar // set ourself as the current view. This is needed for the menu bar
// filling, at least for the static special menu item on Mac. Otherwise // filling, at least for the static special menu item on Mac. Otherwise
@ -436,6 +434,12 @@ void GuiView::constructToolbars()
delete it->second; delete it->second;
d.toolbars_.clear(); d.toolbars_.clear();
// I don't like doing this here, but the standard toolbar
// destroys this object when it's destroyed itself (vfr)
d.layout_ = new LayoutBox(*this);
d.stack_widget_->addWidget(d.layout_);
d.layout_->move(0,0);
// extracts the toolbars from the backend // extracts the toolbars from the backend
Toolbars::Infos::iterator cit = guiApp->toolbars().begin(); Toolbars::Infos::iterator cit = guiApp->toolbars().begin();
Toolbars::Infos::iterator end = guiApp->toolbars().end(); Toolbars::Infos::iterator end = guiApp->toolbars().end();