From d046a1f2fa46eb14b45bfe696a3e2ad08c5110c0 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Sun, 26 Sep 2021 23:27:57 +0200 Subject: Functions: fail early when multi-function throws an exception Multi-functions are not allowed to throw exceptions that are not caught in the same multi-function. Previously, it was difficult to backtrack a crash to a previously thrown exception. --- .../intern/multi_function_procedure_executor.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'source/blender/functions/intern') diff --git a/source/blender/functions/intern/multi_function_procedure_executor.cc b/source/blender/functions/intern/multi_function_procedure_executor.cc index b97282accdd..6d2d121bafd 100644 --- a/source/blender/functions/intern/multi_function_procedure_executor.cc +++ b/source/blender/functions/intern/multi_function_procedure_executor.cc @@ -1022,7 +1022,13 @@ static void execute_call_instruction(const MFCallInstruction &instruction, } } - fn.call(IndexRange(1), params, context); + try { + fn.call(IndexRange(1), params, context); + } + catch (...) { + /* Multi-functions must not throw exceptions. */ + BLI_assert_unreachable(); + } } else { MFParamsBuilder params(fn, &mask); @@ -1038,7 +1044,13 @@ static void execute_call_instruction(const MFCallInstruction &instruction, } } - fn.call(mask, params, context); + try { + fn.call(mask, params, context); + } + catch (...) { + /* Multi-functions must not throw exceptions. */ + BLI_assert_unreachable(); + } } } -- cgit v1.2.3