diff options
Diffstat (limited to 'runtime')
| -rw-r--r-- | runtime/class_linker.cc | 9 | ||||
| -rw-r--r-- | runtime/class_linker.h | 1 | ||||
| -rw-r--r-- | runtime/native/dalvik_system_DexFile.cc | 1 |
3 files changed, 11 insertions, 0 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index dc2ccb40f5..736882546f 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -10389,6 +10389,15 @@ void ClassLinker::SetEnablePublicSdkChecks(bool enabled ATTRIBUTE_UNUSED) { UNREACHABLE(); } +void ClassLinker::RemoveDexFromCaches(const DexFile& dex_file) { + ReaderMutexLock mu(Thread::Current(), *Locks::dex_lock_); + + auto it = dex_caches_.find(&dex_file); + if (it != dex_caches_.end()) { + dex_caches_.erase(it); + } +} + // Instantiate ClassLinker::AllocClass. template ObjPtr<mirror::Class> ClassLinker::AllocClass</* kMovable= */ true>( Thread* self, diff --git a/runtime/class_linker.h b/runtime/class_linker.h index 37e9979395..71d63fbf64 100644 --- a/runtime/class_linker.h +++ b/runtime/class_linker.h @@ -855,6 +855,7 @@ class ClassLinker { virtual bool DenyAccessBasedOnPublicSdk(const char* type_descriptor) const; // Enable or disable public sdk checks. virtual void SetEnablePublicSdkChecks(bool enabled); + void RemoveDexFromCaches(const DexFile& dex_file); protected: virtual bool InitializeClass(Thread* self, diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc index f2c9efcd7d..86e5c547f3 100644 --- a/runtime/native/dalvik_system_DexFile.cc +++ b/runtime/native/dalvik_system_DexFile.cc @@ -406,6 +406,7 @@ static jboolean DexFile_closeDexFile(JNIEnv* env, jclass, jobject cookie) { if (!class_linker->IsDexFileRegistered(soa.Self(), *dex_file)) { // Clear the element in the array so that we can call close again. long_dex_files->Set(i, 0); + class_linker->RemoveDexFromCaches(*dex_file); delete dex_file; } else { all_deleted = false; |