+ if (!closeBufferAll(true)) {
+ closing_ = false;
+ close_event->ignore();
+ return;
+ }
+
+ // Make sure that nothing will use this close to be closed View.
+ guiApp->unregisterView(this);
+
+ if (isFullScreen()) {
+ // Switch off fullscreen before closing.
+ toggleFullScreen();
+ updateDialogs();
+ }
+
+ // Make sure the timer time out will not trigger a statusbar update.
+ d.statusbar_timer_.stop();
+
+ // Saving fullscreen requires additional tweaks in the toolbar code.
+ // It wouldn't also work under linux natively.
+ if (lyxrc.allow_geometry_session) {
+ // Save this window geometry and layout.
+ saveLayout();
+ // Then the toolbar private states.
+ ToolbarMap::iterator end = d.toolbars_.end();
+ for (ToolbarMap::iterator it = d.toolbars_.begin(); it != end; ++it)
+ it->second->saveSession();
+ // Now take care of all other dialogs:
+ map<string, DialogPtr>::const_iterator it = d.dialogs_.begin();
+ for (; it!= d.dialogs_.end(); ++it)
+ it->second->saveSession();
+ }
+
+ close_event->accept();
+}
+
+
+bool GuiView::closeBufferAll(bool tolastopened)
+{