]> git.lyx.org Git - lyx.git/commitdiff
Fix bug 3288:
authorAbdelrazak Younes <younes@lyx.org>
Sun, 1 Apr 2007 16:06:43 +0000 (16:06 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sun, 1 Apr 2007 16:06:43 +0000 (16:06 +0000)
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

src/frontends/qt4/GuiApplication.C
src/frontends/qt4/GuiApplication.h

index 1c72d4936f0d2a5fcd3a4249f49cbb7087a42ec5..1354cea7f00579ca1d4e420077f0716514ab1338 100644 (file)
@@ -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.
index 9e09335f5585677dc669f6cdffffca0af53a24be..6ddc40eaffa153f7a3f96a9a95aa97b0bb59934c 100644 (file)
@@ -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_; }
        ///