summaryrefslogtreecommitdiff
path: root/libartbase/base/mem_map.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libartbase/base/mem_map.cc')
-rw-r--r--libartbase/base/mem_map.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/libartbase/base/mem_map.cc b/libartbase/base/mem_map.cc
index 4c14af132c..5c88b7ee14 100644
--- a/libartbase/base/mem_map.cc
+++ b/libartbase/base/mem_map.cc
@@ -655,9 +655,12 @@ void MemMap::Invalidate() {
DCHECK(IsValid());
// Remove it from gMaps.
- std::lock_guard<std::mutex> mu(*mem_maps_lock_);
- auto it = GetGMapsEntry(*this);
- gMaps->erase(it);
+ // TODO(b/307704260) Move MemMap::Init MemMap::Shutdown out of Runtime init/shutdown.
+ if (mem_maps_lock_ != nullptr) { // Runtime was shutdown.
+ std::lock_guard<std::mutex> mu(*mem_maps_lock_);
+ auto it = GetGMapsEntry(*this);
+ gMaps->erase(it);
+ }
// Mark it as invalid.
base_size_ = 0u;