mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
audio: Delete local refs explicitly in JNI (#336)
This commit is contained in:
parent
b0454b874e
commit
713a537637
@ -96,6 +96,7 @@ static char* initAudioTrack(uintptr_t java_vm, uintptr_t jni_env,
|
|||||||
android_media_AudioTrack_MODE_STREAM);
|
android_media_AudioTrack_MODE_STREAM);
|
||||||
// Note that *audioTrack will never be released.
|
// Note that *audioTrack will never be released.
|
||||||
*audioTrack = (*env)->NewGlobalRef(env, tmpAudioTrack);
|
*audioTrack = (*env)->NewGlobalRef(env, tmpAudioTrack);
|
||||||
|
(*env)->DeleteLocalRef(env, tmpAudioTrack);
|
||||||
|
|
||||||
(*env)->CallVoidMethod(
|
(*env)->CallVoidMethod(
|
||||||
env, *audioTrack,
|
env, *audioTrack,
|
||||||
@ -133,6 +134,7 @@ static char* writeToAudioTrack(uintptr_t java_vm, uintptr_t jni_env,
|
|||||||
env, audioTrack,
|
env, audioTrack,
|
||||||
(*env)->GetMethodID(env, android_media_AudioTrack, "write", "([BII)I"),
|
(*env)->GetMethodID(env, android_media_AudioTrack, "write", "([BII)I"),
|
||||||
arrInBytes, 0, length);
|
arrInBytes, 0, length);
|
||||||
|
(*env)->DeleteLocalRef(env, arrInBytes);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
result =
|
result =
|
||||||
@ -140,6 +142,7 @@ static char* writeToAudioTrack(uintptr_t java_vm, uintptr_t jni_env,
|
|||||||
env, audioTrack,
|
env, audioTrack,
|
||||||
(*env)->GetMethodID(env, android_media_AudioTrack, "write", "([SII)I"),
|
(*env)->GetMethodID(env, android_media_AudioTrack, "write", "([SII)I"),
|
||||||
arrInShorts, 0, length);
|
arrInShorts, 0, length);
|
||||||
|
(*env)->DeleteLocalRef(env, arrInShorts);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user