Fixes #1815, don't release the LocalRef returned by SDL_AndroidGetActivity
authorGabriel Jacobo <gabomdq@gmail.com>
Mon, 22 Apr 2013 11:18:45 -0300
changeset 7083 0cb47cc139d3
parent 7082 e9d6004d2978
child 7084 9d43403e9fc5
Fixes #1815, don't release the LocalRef returned by SDL_AndroidGetActivity
src/core/android/SDL_android.cpp
--- a/src/core/android/SDL_android.cpp	Sat Apr 20 23:05:08 2013 -0400
+++ b/src/core/android/SDL_android.cpp	Mon Apr 22 11:18:45 2013 -0300
@@ -1130,13 +1130,18 @@
     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()
 {
-    LocalReferenceHolder refs(__FUNCTION__);
     jmethodID mid;
 
     JNIEnv *env = Android_JNI_GetEnv();
-    if (!refs.init(env)) {
+    if (!env) {
         return NULL;
     }