summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/java/jvpp
diff options
context:
space:
mode:
authorRobert Varga <robert.varga@pantheon.tech>2017-05-25 16:18:28 +0200
committerNeale Ranns <nranns@cisco.com>2017-05-26 08:20:17 +0000
commit966de205fc272737895e12bf7f57856c2cbf0582 (patch)
treecb385e71c61b8d65775ff1b24552f88bf01aa0c4 /src/vpp-api/java/jvpp
parent71275e3d1ed4b7a536b7ec8d13995743beccde6b (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>
Diffstat (limited to 'src/vpp-api/java/jvpp')
-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});
}
""")