diff options
Diffstat (limited to 'runtime/native/dalvik_system_DexFile.cc')
-rw-r--r-- | runtime/native/dalvik_system_DexFile.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc index 4f97d20d6c..3b84bfa026 100644 --- a/runtime/native/dalvik_system_DexFile.cc +++ b/runtime/native/dalvik_system_DexFile.cc @@ -171,7 +171,7 @@ static jobject DexFile_openDexFileNative( if (array == nullptr) { ScopedObjectAccess soa(env); for (auto& dex_file : dex_files) { - if (Runtime::Current()->GetClassLinker()->IsDexFileRegistered(*dex_file)) { + if (linker->FindDexCache(soa.Self(), *dex_file, true) != nullptr) { dex_file.release(); } } @@ -208,8 +208,9 @@ static void DexFile_closeDexFile(JNIEnv* env, jclass, jobject cookie) { // // TODO: The Runtime should support unloading of classes and freeing of the // dex files for those unloaded classes rather than leaking dex files here. - for (auto& dex_file : *dex_files) { - if (!Runtime::Current()->GetClassLinker()->IsDexFileRegistered(*dex_file)) { + ClassLinker* const class_linker = Runtime::Current()->GetClassLinker(); + for (const DexFile* dex_file : *dex_files) { + if (class_linker->FindDexCache(soa.Self(), *dex_file, true) == nullptr) { delete dex_file; } } |