]> git.lyx.org Git - features.git/commitdiff
* GuiApplication::notify():
authorAbdelrazak Younes <younes@lyx.org>
Fri, 21 Sep 2007 20:27:07 +0000 (20:27 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Fri, 21 Sep 2007 20:27:07 +0000 (20:27 +0000)
- 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

src/frontends/qt4/GuiApplication.cpp

index 45426165a74d7f449b06e90ff3f3aa7571391a9e..6d30f9453341e9d54963e89de6f4ee735a49f3fc 100644 (file)
 #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;