summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/gluegen
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-07-02 13:54:16 +0200
committerSven Gothel <[email protected]>2023-07-02 13:54:16 +0200
commit9b9aa128d92e9512cb00559e99dce9c8de726ed7 (patch)
treedb5e5639ba1be559659888aec7177d0ee4e28a01 /src/java/com/jogamp/gluegen
parent88346aae69cc12c7f6932152697a854039517aa7 (diff)
GlueGen JavaCallback: CMethodBindingEmitter: Check, describe & clear exception if occurring - we must assume async off-thread source in general
Covered by unit tests now
Diffstat (limited to 'src/java/com/jogamp/gluegen')
-rw-r--r--src/java/com/jogamp/gluegen/CMethodBindingEmitter.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java
index fc65fb4..c1b175f 100644
--- a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java
+++ b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java
@@ -409,6 +409,11 @@ public class CMethodBindingEmitter extends FunctionEmitter {
// javaCallback.cbFuncCEmitter.emitBodyPassCArguments();
jcbCMethodEmitter.emitJavaCallbackBodyPassJavaArguments(javaCallback, "cb->userParam");
unit.emitln(");");
+ unit.emitln(" if( (*env)->ExceptionCheck(env) ) {");
+ unit.emitln(" fprintf(stderr, \"Info: Callback '"+jcbFriendlyBasename+"': Exception in Java Callback caught:\\n\");");
+ unit.emitln(" (*env)->ExceptionDescribe(env);");
+ unit.emitln(" (*env)->ExceptionClear(env);");
+ unit.emitln(" }");
// javaCallback.cbFuncCEmitter.emitBodyUserVariableAssignments();
// javaCallback.cbFuncCEmitter.emitBodyVariablePostCallCleanup();