* src/frontends/qt4/GuiApplication.cpp:

- backport rev. 20419 and rev. 20531 from trunk (part of bug 4385):
	   http://www.lyx.org/trac/changeset/20419:
		GuiApplication::notify(): don't crash with abort() but exit gracefully 
		when an exception is caught. try to catch LyX specific exceptions.
	   http://www.lyx.org/trac/changeset/20531:
		Gives the user some information about the crash.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@21914 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2007-12-02 11:28:29 +00:00
parent 0fa3258392
commit 6cf125e841
2 changed files with 26 additions and 5 deletions

View File

@ -18,10 +18,12 @@
#include "QLImage.h"
#include "socket_callback.h"
#include "frontends/alert.h"
#include "frontends/LyXView.h"
#include "graphics/LoaderQueue.h"
#include "support/ExceptionMessage.h"
#include "support/FileName.h"
#include "support/lstrings.h"
#include "support/os.h"
@ -249,19 +251,35 @@ bool GuiApplication::event(QEvent * e)
bool GuiApplication::notify(QObject * receiver, QEvent * event)
{
bool return_value;
bool return_value = false;
try {
return_value = QApplication::notify(receiver, event);
}
catch (support::ExceptionMessage const & e) {
if (e.type_ == support::ErrorException) {
Alert::error(e.title_, e.details_);
LyX::cref().emergencyCleanup();
::exit(1);
} else if (e.type_ == support::WarningException) {
Alert::warning(e.title_, e.details_);
return return_value;
}
}
catch (std::exception const & e) {
lyxerr << "Caught \"normal\" exception: " << e.what() << endl;
docstring s = _("LyX has caught an exception, it will now "
"attemp to save all unsaved documents and exit."
"\n\nException: ");
s += from_ascii(e.what());
Alert::error(_("Software exception Detected"), s);
LyX::cref().emergencyCleanup();
abort();
::exit(1);
}
catch (...) {
lyxerr << "Caught some really weird exception..." << endl;
docstring s = _("LyX has caught some really weird exception, it will "
"now attemp to save all unsaved documents and exit.");
Alert::error(_("Software exception Detected"), s);
LyX::cref().emergencyCleanup();
abort();
::exit(1);
}
return return_value;

View File

@ -87,6 +87,9 @@ What's new
- Fix a crash when exporting a file with a branch from the command line
(bug 4255).
- Exit gracefully and give the user some information if LyX catches an
exception from an external program, such as iconv (part of bug 4385).
- Fix LaTeX output of AMS classes when using layouts like Definition but
not using also Theorem (bug 4282).