]> git.lyx.org Git - lyx.git/commitdiff
Fix memory leaks with multiple windows and crash when deleteOnClose is set.
authorAbdelrazak Younes <younes@lyx.org>
Sun, 3 Dec 2006 13:09:57 +0000 (13:09 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sun, 3 Dec 2006 13:09:57 +0000 (13:09 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16157 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiView.C
src/frontends/qt4/QLPopupMenu.C

index 2615e34462192d9fb2e935070687aa26e32c26b0..c42f97090b1ef4c66d4513604402f772d0f66be3 100644 (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;
 }
 
index 52b94d3dd26c1a5ad514a4fbc8e9956d41bbbe80..03c221ff507bbf2ee405d1d975087584c3a33996 100644 (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());