From 0b01a69198f45be9de87cfbd155b81cce189b8ed Mon Sep 17 00:00:00 2001 From: Gabriel Jacobo Date: Tue, 23 Apr 2013 16:44:54 -0300 Subject: [PATCH] Moved warning about SDL_AndroidGetActivity to SDL_system.h --- include/SDL_system.h | 3 +++ src/core/android/SDL_android.cpp | 8 +++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/SDL_system.h b/include/SDL_system.h index 5ae9e402f..d5db78fd5 100644 --- a/include/SDL_system.h +++ b/include/SDL_system.h @@ -62,6 +62,9 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(); /* Get the SDL Activity object for the application This returns jobject, but the prototype is void* so we don't need jni.h + The jobject returned by SDL_AndroidGetActivity is a local reference. + It is the caller's responsibility to properly release it + (using LocalReferenceHolder or manually with env->DeleteLocalRef) */ extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(); diff --git a/src/core/android/SDL_android.cpp b/src/core/android/SDL_android.cpp index 5ab147e2a..6bdf34317 100644 --- a/src/core/android/SDL_android.cpp +++ b/src/core/android/SDL_android.cpp @@ -1130,14 +1130,12 @@ extern "C" void *SDL_AndroidGetJNIEnv() return Android_JNI_GetEnv(); } -/* - * The jobject returned by SDL_AndroidGetActivity is a local reference. - * It is the caller's responsibility to properly release it - * (using LocalReferenceHolder or manually with env->DeleteLocalRef) - */ + extern "C" void *SDL_AndroidGetActivity() { + /* See SDL_system.h for caveats on using this function. */ + jmethodID mid; JNIEnv *env = Android_JNI_GetEnv();