Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: jni/JniFilter.cpp

Issue 4761138508070912: Issue 1848 - Clean up local reference handling (Closed)
Patch Set: Formatting, explicit, unrelated change Created Feb. 3, 2015, 1:51 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: jni/JniFilter.cpp
diff --git a/jni/JniFilter.cpp b/jni/JniFilter.cpp
index 9f72448496bc9ab0722a91cbdfe247824715c307..e0ffc2cf3ff1b9a61c4626faf206232c3b2f0f5e 100644
--- a/jni/JniFilter.cpp
+++ b/jni/JniFilter.cpp
@@ -66,9 +66,10 @@ static jobject JNICALL JniGetType(JNIEnv* env, jclass clazz, jlong ptr)
break;
}
- jclass enumClass = env->FindClass(PKG("Filter$Type"));
- jfieldID enumField = env->GetStaticFieldID(enumClass, enumName, TYP("Filter$Type"));
- return env->GetStaticObjectField(enumClass, enumField);
+ JniLocalReference<jclass> enumClass(env, env->FindClass(PKG("Filter$Type")));
+ jfieldID enumField = env->GetStaticFieldID(*enumClass, enumName,
+ TYP("Filter$Type"));
+ return env->GetStaticObjectField(*enumClass, enumField);
}
static jboolean JNICALL JniIsListed(JNIEnv* env, jclass clazz, jlong ptr)

Powered by Google App Engine
This is Rietveld