Commit 60b874e2 by Dayananda V Committed by Tianqi Chen

JNI Crash fix (#1357)

parent 32a55f88
...@@ -384,7 +384,7 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmArrayGetShape( ...@@ -384,7 +384,7 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmArrayGetShape(
jmethodID arrayAppend = env->GetMethodID(arrayClass, "add", "(Ljava/lang/Object;)Z"); jmethodID arrayAppend = env->GetMethodID(arrayClass, "add", "(Ljava/lang/Object;)Z");
for (int i = 0; i < ndim; ++i) { for (int i = 0; i < ndim; ++i) {
jobject data = env->NewObject(longClass, newLong, static_cast<jlong>(shape[i])); jobject data = env->NewObject(longClass, newLong, static_cast<jlong>(shape[i]));
env->CallObjectMethod(jshape, arrayAppend, data); env->CallBooleanMethod(jshape, arrayAppend, data);
env->DeleteLocalRef(data); env->DeleteLocalRef(data);
} }
env->DeleteLocalRef(longClass); env->DeleteLocalRef(longClass);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment