mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-10 10:02:38 +03:00
dont decref too early
This commit is contained in:
parent
1866b8845a
commit
d91a90774b
@ -221,9 +221,6 @@ JNIEXPORT jstring JNICALL Java_javaSource_Greeter_sayHello
|
|||||||
// Call the Roc function to populate `ret`'s bytes.
|
// Call the Roc function to populate `ret`'s bytes.
|
||||||
roc__mainForHost_1_exposed_generic(&ret, &arg);
|
roc__mainForHost_1_exposed_generic(&ret, &arg);
|
||||||
|
|
||||||
decref((void *)&ret, alignof(uint8_t *));
|
|
||||||
|
|
||||||
|
|
||||||
// java being java making this a lot harder than it needs to be
|
// java being java making this a lot harder than it needs to be
|
||||||
// https://stackoverflow.com/questions/32205446/getting-true-utf-8-characters-in-java-jni
|
// https://stackoverflow.com/questions/32205446/getting-true-utf-8-characters-in-java-jni
|
||||||
// https://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/types.html#wp16542
|
// https://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/types.html#wp16542
|
||||||
@ -240,6 +237,8 @@ JNIEXPORT jstring JNICALL Java_javaSource_Greeter_sayHello
|
|||||||
|
|
||||||
jstring result = (*env)->NewObject(env, stringClass, stringConstructor, byteArray, charsetName);
|
jstring result = (*env)->NewObject(env, stringClass, stringConstructor, byteArray, charsetName);
|
||||||
|
|
||||||
|
// cleanup
|
||||||
|
decref((void *)&ret, alignof(uint8_t *));
|
||||||
(*env)->DeleteLocalRef(env, charsetName);
|
(*env)->DeleteLocalRef(env, charsetName);
|
||||||
(*env)->ReleaseByteArrayElements(env, byteArray, bytes, 0);
|
(*env)->ReleaseByteArrayElements(env, byteArray, bytes, 0);
|
||||||
(*env)->DeleteLocalRef(env, byteArray);
|
(*env)->DeleteLocalRef(env, byteArray);
|
||||||
|
Loading…
Reference in New Issue
Block a user