Bug 790198 - Cleanup local JNI references in Android plugins r=snorp

This commit is contained in:
Santtu Lakkala 2012-09-11 05:19:00 -04:00
parent 1022a255d2
commit 71db9bf014
2 changed files with 4 additions and 0 deletions

View File

@ -58,6 +58,9 @@ jclass anp_system_loadJavaClass(NPP instance, const char* className)
jstring jclassName = env->NewStringUTF(className);
jstring jlibName = env->NewStringUTF(libName.get());
jobject obj = env->CallStaticObjectMethod(cls, method, jclassName, jlibName);
env->DeleteLocalRef(jlibName);
env->DeleteLocalRef(jclassName);
env->DeleteLocalRef(cls);
return reinterpret_cast<jclass>(obj);
}

View File

@ -2223,6 +2223,7 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
jfieldID field = env->GetStaticFieldID(cls, "mAppContext",
"Lorg/mozilla/gecko/GeckoApp;");
jobject ret = env->GetStaticObjectField(cls, field);
env->DeleteLocalRef(cls);
int32_t* i = reinterpret_cast<int32_t*>(result);
*i = reinterpret_cast<int32_t>(ret);
return NPERR_NO_ERROR;