aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java')
-rw-r--r--src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java
index 1469b4f..047a637 100644
--- a/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java
+++ b/src/java/com/jogamp/gluegen/JavaMethodBindingEmitter.java
@@ -622,6 +622,8 @@ public class JavaMethodBindingEmitter extends FunctionEmitter {
boolean needsResultAssignment = false;
if( null != javaCallback ) {
+ final String userParamArgName = binding.getArgumentName(javaCallback.setFuncUserParamIdx);
+ unit.emitln(" release"+getInterfaceName()+"("+userParamArgName+"); // Ensure a previously mapped instance is released");
unit.emitln(" final long[] nativeUserParam = { 0 };");
}
if (!returnType.isVoid()) {
@@ -658,9 +660,7 @@ public class JavaMethodBindingEmitter extends FunctionEmitter {
final String funcArgName = binding.getArgumentName(javaCallback.setFuncCBParamIdx);
final String userParamArgName = binding.getArgumentName(javaCallback.setFuncUserParamIdx);
// unit.emitln(" System.err.println(\"ZZZ returned nativeUserParam \"+nativeUserParam[0]);");
- unit.emitln(" if( 0 == nativeUserParam[0] ) {");
- unit.emitln(" release"+getInterfaceName()+"("+userParamArgName+");");
- unit.emitln(" } else {");
+ unit.emitln(" if( 0 != nativeUserParam[0] ) {");
unit.emitln(" "+javaCallback.cbFuncTypeName+"UsrMap.put("+userParamArgName+", new "+javaCallback.cbFuncTypeName+"UserParam("+funcArgName+", "+userParamArgName+", nativeUserParam[0]));");
unit.emitln(" }");
}