#include "support/filetools.h"
#include "support/gettext.h"
#include "support/lstrings.h"
-#include "support/lyxlib.h"
#include "support/Messages.h"
#include "support/os.h"
#include "support/Package.h"
#include <iostream>
#include <csignal>
#include <map>
+#include <stdlib.h>
#include <string>
#include <vector>
}
+void LyX::exit(int exit_code) const
+{
+ if (exit_code)
+ // Something wrong happened so better save everything, just in
+ // case.
+ emergencyCleanup();
+
+#ifndef NDEBUG
+ // Properly crash in debug mode in order to get a useful backtrace.
+ abort();
+#endif
+
+ // In release mode, try to exit gracefully.
+ if (theApp())
+ theApp()->exit(exit_code);
+ else
+ exit(exit_code);
+}
+
+
LyX & LyX::ref()
{
BOOST_ASSERT(singleton_);
#else
if (err_sig == SIGSEGV || !getEnv("LYXDEBUG").empty())
#endif
- support::abort();
+ abort();
exit(0);
}
break;
}
case ui_menuset:
- menubackend.read(lex);
+ theApp()->menuBackend().read(lex);
break;
case ui_toolbarset: