* GuiApplication::notify():

- don't crash with abort() but exit gracefully when an exception is caught.
- try to catch LyX specific exceptions.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20419 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-09-21 20:27:07 +00:00
parent ee40d49bea
commit 24a74bdb53

View File

@ -17,10 +17,12 @@
#include "qt_helpers.h"
#include "GuiImage.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"
@ -283,15 +285,25 @@ bool GuiApplication::notify(QObject * receiver, QEvent * event)
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;
LyX::cref().emergencyCleanup();
abort();
::exit(1);
}
catch (...) {
lyxerr << "Caught some really weird exception..." << endl;
LyX::cref().emergencyCleanup();
abort();
::exit(1);
}
return return_value;