Android: Delete more references in IDCache.cpp

It's not causing any problems in practice so far, but let's fix it
before I add even more stuff without remembering to delete references.
This commit is contained in:
JosJuice 2021-03-03 22:58:59 +01:00
parent 2f0bab0192
commit ae5f8853a4

View File

@ -336,11 +336,13 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved)
s_linked_hash_map_init = env->GetMethodID(s_linked_hash_map_class, "<init>", "(I)V"); s_linked_hash_map_init = env->GetMethodID(s_linked_hash_map_class, "<init>", "(I)V");
s_linked_hash_map_put = env->GetMethodID( s_linked_hash_map_put = env->GetMethodID(
s_linked_hash_map_class, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); s_linked_hash_map_class, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
env->DeleteLocalRef(map_class);
const jclass compress_cb_class = const jclass compress_cb_class =
env->FindClass("org/dolphinemu/dolphinemu/utils/CompressCallback"); env->FindClass("org/dolphinemu/dolphinemu/utils/CompressCallback");
s_compress_cb_class = reinterpret_cast<jclass>(env->NewGlobalRef(compress_cb_class)); s_compress_cb_class = reinterpret_cast<jclass>(env->NewGlobalRef(compress_cb_class));
s_compress_cb_run = env->GetMethodID(s_compress_cb_class, "run", "(Ljava/lang/String;F)Z"); s_compress_cb_run = env->GetMethodID(s_compress_cb_class, "run", "(Ljava/lang/String;F)Z");
env->DeleteLocalRef(compress_cb_class);
const jclass content_handler_class = const jclass content_handler_class =
env->FindClass("org/dolphinemu/dolphinemu/utils/ContentHandler"); env->FindClass("org/dolphinemu/dolphinemu/utils/ContentHandler");
@ -358,6 +360,7 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved)
s_content_handler_do_file_search = s_content_handler_do_file_search =
env->GetStaticMethodID(s_content_handler_class, "doFileSearch", env->GetStaticMethodID(s_content_handler_class, "doFileSearch",
"(Ljava/lang/String;[Ljava/lang/String;Z)[Ljava/lang/String;"); "(Ljava/lang/String;[Ljava/lang/String;Z)[Ljava/lang/String;");
env->DeleteLocalRef(content_handler_class);
const jclass network_helper_class = const jclass network_helper_class =
env->FindClass("org/dolphinemu/dolphinemu/utils/NetworkHelper"); env->FindClass("org/dolphinemu/dolphinemu/utils/NetworkHelper");
@ -368,11 +371,13 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved)
env->GetStaticMethodID(s_network_helper_class, "GetNetworkPrefixLength", "()I"); env->GetStaticMethodID(s_network_helper_class, "GetNetworkPrefixLength", "()I");
s_network_helper_get_network_gateway = s_network_helper_get_network_gateway =
env->GetStaticMethodID(s_network_helper_class, "GetNetworkGateway", "()I"); env->GetStaticMethodID(s_network_helper_class, "GetNetworkGateway", "()I");
env->DeleteLocalRef(network_helper_class);
const jclass boolean_supplier_class = const jclass boolean_supplier_class =
env->FindClass("org/dolphinemu/dolphinemu/utils/BooleanSupplier"); env->FindClass("org/dolphinemu/dolphinemu/utils/BooleanSupplier");
s_boolean_supplier_class = reinterpret_cast<jclass>(env->NewGlobalRef(boolean_supplier_class)); s_boolean_supplier_class = reinterpret_cast<jclass>(env->NewGlobalRef(boolean_supplier_class));
s_boolean_supplier_get = env->GetMethodID(s_boolean_supplier_class, "get", "()Z"); s_boolean_supplier_get = env->GetMethodID(s_boolean_supplier_class, "get", "()Z");
env->DeleteLocalRef(boolean_supplier_class);
return JNI_VERSION; return JNI_VERSION;
} }
@ -393,6 +398,7 @@ void JNI_OnUnload(JavaVM* vm, void* reserved)
env->DeleteGlobalRef(s_compress_cb_class); env->DeleteGlobalRef(s_compress_cb_class);
env->DeleteGlobalRef(s_content_handler_class); env->DeleteGlobalRef(s_content_handler_class);
env->DeleteGlobalRef(s_network_helper_class); env->DeleteGlobalRef(s_network_helper_class);
env->DeleteGlobalRef(s_boolean_supplier_class);
} }
#ifdef __cplusplus #ifdef __cplusplus