aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Varga <robert.varga@pantheon.tech>2017-05-25 16:18:28 +0200
committerRobert Varga <nite@hq.sk>2017-05-25 17:07:44 +0000
commite3b7ad7adebf25af1651a217da8534ada89c369b (patch)
tree8f7e8ce6ba1da549ff76fc9f064b313768528dda
parent2cf84308264c266c90165876bddf967bc3fe227e (diff)
Fix JNI templates
The JNI templates around array and object handling are wrong in the sense that they fail to delete local references for objects which have been assigned to fields/arrays. Fix this by invoking DeleteLocalRef. Change-Id: I1c31d81f4235d821ccd51c96be7b176f64284928 Signed-off-by: Robert Varga <robert.varga@pantheon.tech> Signed-off-by: Robert Varga <nite@hq.sk>
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/types_gen.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/types_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/types_gen.py
index 93883ba1a3b..22018e67009 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/types_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/types_gen.py
@@ -83,6 +83,7 @@ object_dto_field_setter_template = Template("""
jobject ${field_reference_name} = (*env)->NewObject(env, ${field_reference_name}Class, ${field_reference_name}Constructor);
${type_initialization}
(*env)->SetObjectField(env, dto, ${field_reference_name}FieldId, ${field_reference_name});
+ (*env)->DeleteLocalRef(env, ${field_reference_name});
}
""")
@@ -96,8 +97,10 @@ object_array_dto_field_setter_template = Template("""
jobject ${field_reference_name}ArrayElement = (*env)->NewObject(env, ${field_reference_name}Class, ${field_reference_name}Constructor);
${type_initialization}
(*env)->SetObjectArrayElement(env, ${field_reference_name}, _i, ${field_reference_name}ArrayElement);
+ (*env)->DeleteLocalRef(env, ${field_reference_name}ArrayElement);
}
(*env)->SetObjectField(env, dto, ${field_reference_name}FieldId, ${field_reference_name});
+ (*env)->DeleteLocalRef(env, ${field_reference_name});
}
""")