# HG changeset patch # User Gabriel Jacobo # Date 1328972580 10800 # Branch RenderCopyEx # Node ID 82f51cac438a58769e51ca2dc997f463187118fe # Parent 7d097f543601a6b9dc107ec74475eb586576235c Android_JNI_FileClose had one lingering Local Reference, this produces a problem if 496 files are open, as the 497th won't have enough space in the local ref table to allocate 16 entries. This patch solves this and adds an extra measure of protection in case we forget in the future to release local references here. diff -r 7d097f543601 -r 82f51cac438a android-project/jni/src/Android.mk --- a/android-project/jni/src/Android.mk mar ene 31 10:07:19 2012 -0300 +++ b/android-project/jni/src/Android.mk sáb feb 11 12:03:00 2012 -0300 @@ -12,7 +12,7 @@ LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.cpp \ YourSourceHere.c -LOCAL_SHARED_LIBRARIES := SDL +LOCAL_SHARED_LIBRARIES := SDL2 LOCAL_LDLIBS := -lGLESv1_CM -llog diff -r 7d097f543601 -r 82f51cac438a src/core/android/SDL_android.cpp --- a/src/core/android/SDL_android.cpp mar ene 31 10:07:19 2012 -0300 +++ b/src/core/android/SDL_android.cpp sáb feb 11 12:03:00 2012 -0300 @@ -557,6 +557,14 @@ static int Android_JNI_FileClose(SDL_RWops* ctx, bool release) { int result = 0; + bool allocatedLocalFrame = false; + + if (mEnv->PushLocalFrame(16) < 0) { + SDL_SetError("Failed to allocate enough JVM local references"); + return -1; + } else { + allocatedLocalFrame = true; + } if (ctx) { if (release) { @@ -580,6 +588,10 @@ } } + if (allocatedLocalFrame) { + mEnv->PopLocalFrame(NULL); + } + return result; }