From 561b15e260fa70504f5ad163e5d7bdee0d0f0ad1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20K=C3=B6sel?= Date: Sat, 24 Oct 2015 14:26:59 +0200 Subject: [PATCH] Fix memory leak in Enhance-API --- cocos/platform/android/CCEnhanceAPI-android.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cocos/platform/android/CCEnhanceAPI-android.cpp b/cocos/platform/android/CCEnhanceAPI-android.cpp index 5e036cbd96..96b9d84b2d 100644 --- a/cocos/platform/android/CCEnhanceAPI-android.cpp +++ b/cocos/platform/android/CCEnhanceAPI-android.cpp @@ -52,6 +52,7 @@ int EnhanceAPI::setResolutionPercent(int n) if(JniHelper::getStaticMethodInfo(t, CLASS_NAME, "setResolutionPercent", "(I)I")) { ret = t.env->CallStaticIntMethod(t.classID, t.methodID, n); + t.env->DeleteLocalRef(t.classID); } return ret; } @@ -63,6 +64,7 @@ int EnhanceAPI::setFPS(int fps) if(JniHelper::getStaticMethodInfo(t, CLASS_NAME, "setFPS", "(I)I")) { ret = t.env->CallStaticIntMethod(t.classID, t.methodID, fps); + t.env->DeleteLocalRef(t.classID); } return ret; } @@ -74,6 +76,7 @@ int EnhanceAPI::fastLoading(int sec) if(JniHelper::getStaticMethodInfo(t, CLASS_NAME, "fastLoading", "(I)I")) { ret = t.env->CallStaticIntMethod(t.classID, t.methodID, sec); + t.env->DeleteLocalRef(t.classID); } return ret; } @@ -85,6 +88,7 @@ int EnhanceAPI::getTemperature() if(JniHelper::getStaticMethodInfo(t, CLASS_NAME, "getTemperature", "()I")) { ret = t.env->CallStaticIntMethod(t.classID, t.methodID); + t.env->DeleteLocalRef(t.classID); } return ret; } @@ -96,6 +100,7 @@ int EnhanceAPI::setLowPowerMode(bool enable) if(JniHelper::getStaticMethodInfo(t, CLASS_NAME, "setLowPowerMode", "(Z)I")) { ret = t.env->CallStaticIntMethod(t.classID, t.methodID, enable); + t.env->DeleteLocalRef(t.classID); } return ret; }