]> git.lyx.org Git - features.git/commitdiff
Fix bug 3236 and 3237.
authorAbdelrazak Younes <younes@lyx.org>
Wed, 14 Feb 2007 13:39:11 +0000 (13:39 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 14 Feb 2007 13:39:11 +0000 (13:39 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17182 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiView.C

index 7ac88310a933d11e6a1e1c1997714d7c8ae3bbef..f1d351badf910af0c81df2ce9c0d241d8b91d5dd 100644 (file)
@@ -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();
 }