From 2ab3247df4637c6b64e1582b74ed6c33625f8800 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Wed, 14 Feb 2007 13:39:11 +0000 Subject: [PATCH] Fix bug 3236 and 3237. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17182 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiView.C | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/frontends/qt4/GuiView.C b/src/frontends/qt4/GuiView.C index 7ac88310a9..f1d351badf 100644 --- a/src/frontends/qt4/GuiView.C +++ b/src/frontends/qt4/GuiView.C @@ -243,12 +243,21 @@ void GuiView::closeEvent(QCloseEvent * close_event) { // we may have been called through the close window button // which bypasses the LFUN machinery. - if (!quitting_by_menu_) { + if (!quitting_by_menu_ && theApp()->gui().viewIds().size() == 1) { if (!theBufferList().quitWriteAll()) { close_event->ignore(); return; } } + + theApp()->gui().unregisterView(id()); + if (!theApp()->gui().viewIds().empty()) { + // Just close the window and do nothing else if this is not the + // last window. + close_event->accept(); + return; + } + if (view()->buffer()) { // save cursor position for opened files to .lyx/session LyX::ref().session().lastFilePos().save( @@ -256,17 +265,13 @@ void GuiView::closeEvent(QCloseEvent * close_event) boost::tie(view()->cursor().pit(), view()->cursor().pos())); } - theApp()->gui().unregisterView(id()); - if (theApp()->gui().viewIds().empty()) - { - // this is the place where we leave the frontend. - // it is the only point at which we start quitting. - saveGeometry(); - close_event->accept(); - // quit the event loop - qApp->quit(); - } + + // this is the place where we leave the frontend. + // it is the only point at which we start quitting. + saveGeometry(); close_event->accept(); + // quit the event loop + qApp->quit(); }