From f72186c1cde9734b6b720c00eaaea2da0ceaaebe Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 3 Nov 2015 17:36:54 +0100 Subject: [PATCH] add option --no-try-catch --- Polyhedron/demo/Polyhedron/Polyhedron_3.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_3.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_3.cpp index acfc736b560..48f2e13248b 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_3.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_3.cpp @@ -9,18 +9,28 @@ class Polyhedron_demo : public QApplication { + bool catch_exceptions; public: /*! * Constructor : calls the constructor of QApplication. */ - Polyhedron_demo(int& argc, char **argv) : QApplication(argc, argv) {} + Polyhedron_demo(int& argc, char **argv) + : QApplication(argc, argv) + , catch_exceptions(true) + {} + + void do_not_catch_exceptions() { + catch_exceptions = false; + } /*! * Catches unhandled exceptions from all the widgets. */ bool notify(QObject* receiver, QEvent* event) { - try { + if(!catch_exceptions) + return QApplication::notify(receiver, event); + else try { return QApplication::notify(receiver, event); } catch (std::exception &e) { // find the mainwindow to spawn an error message @@ -69,6 +79,11 @@ int main(int argc, char **argv) mainWindow.setAddKeyFrameKeyboardModifiers(::Qt::MetaModifier); args.removeAt(0); } + if(!args.empty() && args[0] == "--no-try-catch") + { + app.do_not_catch_exceptions(); + args.removeAt(0); + } #ifdef QT_SCRIPT_LIB if(!args.empty() && args[0] == "--debug-scripts") {