Fix memory leaks with multiple windows and crash when deleteOnClose is set.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16157 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-12-03 13:09:57 +00:00
parent 6a96321573
commit 7df55755ac
2 changed files with 5 additions and 3 deletions

View File

@ -157,9 +157,7 @@ GuiView::GuiView(int id)
{
// Qt bug? signal lastWindowClosed does not work
setAttribute(Qt::WA_QuitOnClose, false);
// FIXME: the following statement avoids memory leaks but produces a
// crash after a new window has been closed (click into the menu)
//setAttribute(Qt::WA_DeleteOnClose, true);
setAttribute(Qt::WA_DeleteOnClose, true);
// hardcode here the platform specific icon size
d.smallIconSize = 14; // scaling problems
@ -180,6 +178,7 @@ GuiView::GuiView(int id)
GuiView::~GuiView()
{
menubar_.reset();
delete &d;
}

View File

@ -72,6 +72,9 @@ void QLPopupMenu::update()
if (name_.empty())
return;
// Here, We make sure that theLyXFunc points to the correct LyXView.
theLyXFunc().setLyXView(owner_->view());
Menu const & fromLyxMenu = owner_->backend().getMenu(name_);
owner_->backend().expand(fromLyxMenu, topLevelMenu_, owner_->view()->buffer());