Index: jni/JniUpdateCheckDoneCallback.cpp |
diff --git a/jni/JniUpdateCheckDoneCallback.cpp b/jni/JniUpdateCheckDoneCallback.cpp |
index 817eb462e06a491168348df60b2ee8922d085710..3b96fa20599d77abd666ced25e247cd1639fa2ed 100644 |
--- a/jni/JniUpdateCheckDoneCallback.cpp |
+++ b/jni/JniUpdateCheckDoneCallback.cpp |
@@ -41,13 +41,14 @@ 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", "(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); |