diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index ead359faa7..7a20361716 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -1250,7 +1250,7 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr) // clear the last opened list, because // maybe this will end the session theSession().lastOpened().clear(); - current_view_->close(); + current_view_->closeScheduled(); break; case LFUN_LYX_QUIT: @@ -2254,7 +2254,7 @@ bool GuiApplication::closeAllViews() QList views = d->views_.values(); foreach (GuiView * view, views) { - if (!view->close()) + if (!view->closeScheduled()) return false; } diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 7823cc9e8c..735919925f 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -663,6 +663,13 @@ void GuiView::showEvent(QShowEvent * e) } +bool GuiView::closeScheduled() +{ + closing_ = true; + return close(); +} + + /** Destroy only all tabbed WorkAreas. Destruction of other WorkAreas ** is responsibility of the container (e.g., dialog) **/ @@ -676,6 +683,10 @@ void GuiView::closeEvent(QCloseEvent * close_event) return; } + // If the user pressed the x (so we didn't call closeView + // programmatically), we want to clear all existing entries. + if (!closing_) + theSession().lastOpened().clear(); closing_ = true; writeSession(); diff --git a/src/frontends/qt4/GuiView.h b/src/frontends/qt4/GuiView.h index 33f9fb3108..72a53dbdc6 100644 --- a/src/frontends/qt4/GuiView.h +++ b/src/frontends/qt4/GuiView.h @@ -71,6 +71,10 @@ public: ~GuiView(); + /// closes the view such that the view knows that is closed + /// programmatically and not by the user clicking the x. + bool closeScheduled(); + int id() const { return id_; } ///