Fix for issue #1465, Leak in Android_JNI_SetActivityTitle (SDL_SetWindowTitle)
authorGabriel Jacobo <gabomdq@gmail.com>
Fri, 25 May 2012 15:10:13 -0300
changeset 6307 6048116f40b1
parent 6305 601b0e251822
child 6308 263e2c049c22
Fix for issue #1465, Leak in Android_JNI_SetActivityTitle (SDL_SetWindowTitle) Thanks Martin Gerhardy!
src/core/android/SDL_android.cpp
--- a/src/core/android/SDL_android.cpp	Mon Apr 09 23:55:43 2012 -0400
+++ b/src/core/android/SDL_android.cpp	Fri May 25 15:10:13 2012 -0300
@@ -259,7 +259,9 @@
 
     mid = mEnv->GetStaticMethodID(mActivityClass,"setActivityTitle","(Ljava/lang/String;)V");
     if (mid) {
-        mEnv->CallStaticVoidMethod(mActivityClass, mid, mEnv->NewStringUTF(title));
+        jstring jtitle = reinterpret_cast<jstring>(mEnv->NewStringUTF(title));
+        mEnv->CallStaticVoidMethod(mActivityClass, mid, jtitle);
+        mEnv->DeleteLocalRef(jtitle);
     }
 }