From: Abdelrazak Younes Date: Sun, 1 Apr 2007 16:06:43 +0000 (+0000) Subject: Fix bug 3288: X-Git-Tag: 1.6.10~10374 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=7384d0cf67c50f79841249e07ae4c57f6375b8e5;p=lyx.git Fix bug 3288: http://bugzilla.lyx.org/show_bug.cgi?id=3288 This is recommended by Qt: Qt has caught an exception thrown from an event handler. Throwing exceptions from an event handler is not supported in Qt. You must reimplement QApplication::notify() and catch all exceptions there. * GuiApplication::notify(): reimplemented from QApplication::notify(). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17688 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/GuiApplication.C b/src/frontends/qt4/GuiApplication.C index 1c72d4936f..1354cea7f0 100644 --- a/src/frontends/qt4/GuiApplication.C +++ b/src/frontends/qt4/GuiApplication.C @@ -30,6 +30,7 @@ #include "Color.h" #include "debug.h" #include "funcrequest.h" +#include "gettext.h" #include "lyx_main.h" #include "lyxfunc.h" #include "lyxrc.h" @@ -214,6 +215,24 @@ bool GuiApplication::event(QEvent * e) } +bool GuiApplication::notify(QObject * receiver, QEvent * event) +{ + bool return_value; + try { + return_value = QApplication::notify(receiver, event); + } + catch (...) { + lyxerr << to_utf8(_("ERROR: Exception caught in the Qt event loop, exiting...")) + << endl; + + LyX::cref().emergencyCleanup(); + abort(); + } + + return return_value; +} + + void GuiApplication::syncEvents() { // This is the ONLY place where processEvents may be called. diff --git a/src/frontends/qt4/GuiApplication.h b/src/frontends/qt4/GuiApplication.h index 9e09335f55..6ddc40eaff 100644 --- a/src/frontends/qt4/GuiApplication.h +++ b/src/frontends/qt4/GuiApplication.h @@ -71,6 +71,11 @@ public: void unregisterSocketCallback(int fd); //@} + /// Methods inherited from \c Application class + //@{ + virtual bool notify(QObject * receiver, QEvent * event); + //@} + /// ColorCache & colorCache() { return color_cache_; } ///