Android: Fix possible reference overflow when scanning
This commit is contained in:
parent
63562e4527
commit
5b4aff5edf
|
@ -37,16 +37,16 @@ void AndroidProgressCallback::SetTitle(const char* title)
|
||||||
{
|
{
|
||||||
Assert(title);
|
Assert(title);
|
||||||
JNIEnv* env = AndroidHelpers::GetJNIEnv();
|
JNIEnv* env = AndroidHelpers::GetJNIEnv();
|
||||||
jstring text_jstr = env->NewStringUTF(title);
|
LocalRefHolder<jstring> text_jstr(env, env->NewStringUTF(title));
|
||||||
env->CallVoidMethod(m_java_object, m_set_title_method, text_jstr);
|
env->CallVoidMethod(m_java_object, m_set_title_method, text_jstr.Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidProgressCallback::SetStatusText(const char* text)
|
void AndroidProgressCallback::SetStatusText(const char* text)
|
||||||
{
|
{
|
||||||
Assert(text);
|
Assert(text);
|
||||||
JNIEnv* env = AndroidHelpers::GetJNIEnv();
|
JNIEnv* env = AndroidHelpers::GetJNIEnv();
|
||||||
jstring text_jstr = env->NewStringUTF(text);
|
LocalRefHolder<jstring> text_jstr(env, env->NewStringUTF(text));
|
||||||
env->CallVoidMethod(m_java_object, m_set_status_text_method, text_jstr);
|
env->CallVoidMethod(m_java_object, m_set_status_text_method, text_jstr.Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidProgressCallback::SetProgressRange(u32 range)
|
void AndroidProgressCallback::SetProgressRange(u32 range)
|
||||||
|
@ -59,7 +59,10 @@ void AndroidProgressCallback::SetProgressRange(u32 range)
|
||||||
|
|
||||||
void AndroidProgressCallback::SetProgressValue(u32 value)
|
void AndroidProgressCallback::SetProgressValue(u32 value)
|
||||||
{
|
{
|
||||||
|
const u32 old_value = m_progress_value;
|
||||||
BaseProgressCallback::SetProgressValue(value);
|
BaseProgressCallback::SetProgressValue(value);
|
||||||
|
if (old_value == m_progress_value)
|
||||||
|
return;
|
||||||
|
|
||||||
JNIEnv* env = AndroidHelpers::GetJNIEnv();
|
JNIEnv* env = AndroidHelpers::GetJNIEnv();
|
||||||
env->CallVoidMethod(m_java_object, m_set_progress_value_method, static_cast<jint>(value));
|
env->CallVoidMethod(m_java_object, m_set_progress_value_method, static_cast<jint>(value));
|
||||||
|
@ -89,22 +92,22 @@ void AndroidProgressCallback::ModalError(const char* message)
|
||||||
{
|
{
|
||||||
Assert(message);
|
Assert(message);
|
||||||
JNIEnv* env = AndroidHelpers::GetJNIEnv();
|
JNIEnv* env = AndroidHelpers::GetJNIEnv();
|
||||||
jstring message_jstr = env->NewStringUTF(message);
|
LocalRefHolder<jstring> message_jstr(env, env->NewStringUTF(message));
|
||||||
env->CallVoidMethod(m_java_object, m_modal_error_method, message_jstr);
|
env->CallVoidMethod(m_java_object, m_modal_error_method, message_jstr.Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AndroidProgressCallback::ModalConfirmation(const char* message)
|
bool AndroidProgressCallback::ModalConfirmation(const char* message)
|
||||||
{
|
{
|
||||||
Assert(message);
|
Assert(message);
|
||||||
JNIEnv* env = AndroidHelpers::GetJNIEnv();
|
JNIEnv* env = AndroidHelpers::GetJNIEnv();
|
||||||
jstring message_jstr = env->NewStringUTF(message);
|
LocalRefHolder<jstring> message_jstr(env, env->NewStringUTF(message));
|
||||||
return env->CallBooleanMethod(m_java_object, m_modal_confirmation_method, message_jstr);
|
return env->CallBooleanMethod(m_java_object, m_modal_confirmation_method, message_jstr.Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidProgressCallback::ModalInformation(const char* message)
|
void AndroidProgressCallback::ModalInformation(const char* message)
|
||||||
{
|
{
|
||||||
Assert(message);
|
Assert(message);
|
||||||
JNIEnv* env = AndroidHelpers::GetJNIEnv();
|
JNIEnv* env = AndroidHelpers::GetJNIEnv();
|
||||||
jstring message_jstr = env->NewStringUTF(message);
|
LocalRefHolder<jstring> message_jstr(env, env->NewStringUTF(message));
|
||||||
env->CallVoidMethod(m_java_object, m_modal_information_method, message_jstr);
|
env->CallVoidMethod(m_java_object, m_modal_information_method, message_jstr.Get());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue