[Bf-blender-cvs] [d046a1f2fa4] master: Functions: fail early when multi-function throws an exception

Jacques Lucke noreply at git.blender.org
Sun Sep 26 23:30:43 CEST 2021


Commit: d046a1f2fa46eb14b45bfe696a3e2ad08c5110c0
Author: Jacques Lucke
Date:   Sun Sep 26 23:27:57 2021 +0200
Branches: master
https://developer.blender.org/rBd046a1f2fa46eb14b45bfe696a3e2ad08c5110c0

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.

===================================================================

M	source/blender/functions/intern/multi_function_procedure_executor.cc

===================================================================

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();
+    }
   }
 }



More information about the Bf-blender-cvs mailing list