Removed code from GetPrimtiveArrayCritical() experiment
authorSam Lantinga <slouken@libsdl.org>
Thu, 13 Jan 2011 12:36:59 -0800
changeset 4997 a21501393bef
parent 4996 8d7315668e35
child 4998 a514bfe6952a
Removed code from GetPrimtiveArrayCritical() experiment
src/SDL_android.cpp
--- a/src/SDL_android.cpp	Thu Jan 13 12:32:55 2011 -0800
+++ b/src/SDL_android.cpp	Thu Jan 13 12:36:59 2011 -0800
@@ -211,14 +211,11 @@
 
 extern "C" void * Android_JNI_GetAudioBuffer()
 {
-    //jboolean isCopy = JNI_FALSE;
-    //audioBufferPinned = mAudioEnv->GetPrimitiveArrayCritical((jarray)audioBuffer, &isCopy);
     return audioBufferPinned;
 }
 
 extern "C" void Android_JNI_WriteAudioBuffer()
 {
-    //mAudioEnv->ReleasePrimitiveArrayCritical((jarray)audioBuffer, audioBufferPinned, 0);
     if (audioBuffer16Bit) {
         mAudioEnv->ReleaseShortArrayElements((jshortArray)audioBuffer, (jshort *)audioBufferPinned, JNI_COMMIT);
         mAudioEnv->CallStaticVoidMethod(mActivityInstance, midAudioWriteShortBuffer, (jshortArray)audioBuffer);
@@ -234,8 +231,11 @@
 {
     mEnv->CallStaticVoidMethod(mActivityInstance, midAudioQuit); 
 
-    mEnv->DeleteGlobalRef(audioBuffer);
-    audioBuffer = NULL;
+    if (audioBuffer) {
+        mEnv->DeleteGlobalRef(audioBuffer);
+        audioBuffer = NULL;
+        audioBufferPinned = NULL;
+    }
 }
 
 /* vi: set ts=4 sw=4 expandtab: */