From 847906e2e48436b04d03625937a07f7f8565efbc Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 2 Dec 2016 12:04:47 +0100 Subject: [PATCH] Extend --no-try-catch to catching of C++ exceptions in Qt scripts --- Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp | 1 + Three/include/CGAL/Three/exceptions.h | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp index 45add22401f..aaddc1fcb72 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp @@ -100,6 +100,7 @@ Polyhedron_demo::~Polyhedron_demo() {} void Polyhedron_demo::do_not_catch_exceptions() { d_ptr->catch_exceptions = false; + setProperty("no-try-catch", true); } bool Polyhedron_demo::notify(QObject* receiver, QEvent* event) diff --git a/Three/include/CGAL/Three/exceptions.h b/Three/include/CGAL/Three/exceptions.h index ad088abaa3c..137df71a3c1 100644 --- a/Three/include/CGAL/Three/exceptions.h +++ b/Three/include/CGAL/Three/exceptions.h @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -81,7 +82,8 @@ wrap_a_call_to_cpp(Callable f, typedef Optional_or_bool O_r_b; typedef typename O_r_b::type Return_type; - if(qs == 0 || !qs->context()) return O_r_b::invoke(f); + const bool no_try_catch = qApp->property("no-try-catch").toBool(); + if(no_try_catch || qs == 0 || !qs->context()) return O_r_b::invoke(f); else try { return O_r_b::invoke(f);