From 0e67e8423f55af58ab8e9b5c4d0b5776a1df0cbc Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Thu, 28 Feb 2008 20:40:55 +0000 Subject: [PATCH] GuiApplication::notify(): fine tune ErrorException handling; close all windows before showing the alert. This should get rid of the recursive alert box when an the exception is caught. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23333 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiApplication.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index 707bdbad0d..5436944aee 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -468,8 +468,16 @@ bool GuiApplication::notify(QObject * receiver, QEvent * event) } catch (ExceptionMessage const & e) { if (e.type_ == ErrorException) { + LyX::cref().emergencyCleanup(); + setQuitOnLastWindowClosed(false); + closeAllViews(); Alert::error(e.title_, e.details_); - LyX::cref().exit(1); +#ifndef NDEBUG + // Properly crash in debug mode in order to get a useful backtrace. + abort(); +#endif + // In release mode, try to exit gracefully. + this->exit(1); } else if (e.type_ == WarningException) { Alert::warning(e.title_, e.details_); return false;