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

Unified Diff: jni/JniUpdateCheckDoneCallback.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/JniUpdateCheckDoneCallback.cpp
diff --git a/jni/JniUpdateCheckDoneCallback.cpp b/jni/JniUpdateCheckDoneCallback.cpp
index 817eb462e06a491168348df60b2ee8922d085710..87afb66539860b20d7f3d6ead340df3f590fb8eb 100644
--- a/jni/JniUpdateCheckDoneCallback.cpp
+++ b/jni/JniUpdateCheckDoneCallback.cpp
@@ -41,13 +41,15 @@ void JniUpdateCheckDoneCallback::Callback(const std::string& arg)
{
JNIEnvAcquire env(GetJavaVM());
- jclass clazz = env->GetObjectClass(GetCallbackObject());
- jmethodID method = env->GetMethodID(clazz, "updateCheckDoneCallback", "(Ljava/lang/String;)V");
+ jmethodID method = env->GetMethodID(
+ *JniLocalReference<jclass>(*env,
+ env->GetObjectClass(GetCallbackObject())), "updateCheckDoneCallback",
Felix Dahlke 2015/02/04 04:11:51 Since you changed this in JniUpdateAvailableCallba
René Jeschke 2015/02/04 12:02:47 Done.
+ "(Ljava/lang/String;)V");
if (method)
{
- jstring jArg = env->NewStringUTF(arg.c_str());
- env->CallVoidMethod(GetCallbackObject(), method, jArg);
+ JniLocalReference<jstring> jArg(*env, env->NewStringUTF(arg.c_str()));
+ env->CallVoidMethod(GetCallbackObject(), method, *jArg);
}
CheckAndLogJavaException(*env);
« no previous file with comments | « jni/JniUpdateAvailableCallback.cpp ('k') | jni/JniWebRequest.cpp » ('j') | jni/JniWebRequest.cpp » ('J')

Powered by Google App Engine
This is Rietveld