Get rid of 'quitting' global variable. It is not needed anymore because all windows are closed in order now and the frontend/core is properly separated.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23280 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-02-27 12:30:41 +00:00
parent 3128c45b24
commit 8c8ff137da
5 changed files with 3 additions and 35 deletions

View File

@ -83,8 +83,6 @@ namespace os = support::os;
bool use_gui = true;
bool quitting; // flag, that we are quitting the program
namespace {
// Filled with the command line arguments "foo" of "-sysdir foo" or
@ -458,10 +456,6 @@ void LyX::prepareExit()
cap::clearCutStack();
cap::clearSelection();
// Set a flag that we do quitting from the program,
// so no refreshes are necessary.
quitting = true;
// close buffers first
pimpl_->buffer_list_.closeAll();

View File

@ -38,7 +38,6 @@ class KeyMap;
class CmdDef;
extern bool use_gui;
extern bool quitting;
namespace frontend {
class Application;

View File

@ -206,7 +206,7 @@ void LyXFunc::initKeySequences(KeyMap * kb)
void LyXFunc::setLyXView(LyXView * lv)
{
if (!quitting && lyx_view_ && lyx_view_->view() && lyx_view_ != lv)
if (lyx_view_ && lyx_view_->view() && lyx_view_ != lv)
// save current selection to the selection buffer to allow
// middle-button paste in another window
cap::saveSelection(lyx_view_->view()->cursor());
@ -1742,7 +1742,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
theSelection().haveSelection(view()->cursor().selection());
}
}
if (!quitting && lyx_view_) {
if (lyx_view_) {
// Some messages may already be translated, so we cannot use _()
sendDispatchMessage(translateIfPossible(getMessage()), cmd);
}

View File

@ -433,20 +433,7 @@ void GuiView::closeEvent(QCloseEvent * close_event)
}
guiApp->unregisterView(id_);
if (guiApp->viewCount() > 0) {
// Just close the window and do nothing else if this is not the
// last window.
close_event->accept();
return;
}
quitting = true;
// this is the place where we leave the frontend.
// it is the only point at which we start quitting.
close_event->accept();
// quit the event loop
qApp->quit();
}
@ -1783,8 +1770,6 @@ bool GuiView::dispatch(FuncRequest const & cmd)
break;
case LFUN_DIALOG_HIDE: {
if (quitting)
break;
guiApp->hideDialogs(to_utf8(cmd.argument()), 0);
break;
}
@ -2094,13 +2079,6 @@ bool GuiView::isDialogVisible(string const & name) const
void GuiView::hideDialog(string const & name, Inset * inset)
{
// Don't send the signal if we are quitting, because on MSVC it is
// destructed before the cut stack in CutAndPaste.cpp, and this method
// is called from some inset destructor if the cut stack is not empty
// on exit.
if (quitting)
return;
map<string, DialogPtr>::const_iterator it = d.dialogs_.find(name);
if (it == d.dialogs_.end())
return;

View File

@ -25,7 +25,6 @@
#include "DispatchResult.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
#include "LyX.h" // quitting
#include "MetricsInfo.h"
#include "Text.h"
#include "TextClass.h"
@ -393,9 +392,7 @@ void Inset::setDimCache(MetricsInfo const & mi, Dimension const & dim) const
Buffer const * Inset::updateFrontend() const
{
if (quitting)
return 0;
return theApp()->updateInset(this);
return theApp()? theApp()->updateInset(this) : 0;
}
} // namespace lyx