diff options
| author | 2015-09-08 17:50:48 -0700 | |
|---|---|---|
| committer | 2015-09-08 17:57:01 -0700 | |
| commit | acd20ca4edcae752e3e555517fa6f8378177262c (patch) | |
| tree | 3f4ff9ad32076624abaf50bde1769ef56ef28e4d /runtime/java_vm_ext.cc | |
| parent | e6576390f957c82c2aede438834d028066757368 (diff) | |
Allow null current thread in jni weak ref decode during shutdown.
Fix a crash during a runtime shutdown for the read barrier config.
Bug: 23897251
Bug: 12687968
Change-Id: Iea0888cb6d052d4becddba289dc0ed121461e97d
Diffstat (limited to 'runtime/java_vm_ext.cc')
| -rw-r--r-- | runtime/java_vm_ext.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/runtime/java_vm_ext.cc b/runtime/java_vm_ext.cc index 92eef3983b..63e8887ff3 100644 --- a/runtime/java_vm_ext.cc +++ b/runtime/java_vm_ext.cc @@ -580,9 +580,12 @@ inline bool JavaVMExt::MayAccessWeakGlobals(Thread* self) const { } inline bool JavaVMExt::MayAccessWeakGlobalsUnlocked(Thread* self) const { - return kUseReadBarrier - ? self->GetWeakRefAccessEnabled() - : allow_accessing_weak_globals_.LoadSequentiallyConsistent(); + if (kUseReadBarrier) { + // self can be null during a runtime shutdown. ~Runtime()->~ClassLinker()->DecodeWeakGlobal(). + return self != nullptr ? self->GetWeakRefAccessEnabled() : true; + } else { + return allow_accessing_weak_globals_.LoadSequentiallyConsistent(); + } } mirror::Object* JavaVMExt::DecodeWeakGlobal(Thread* self, IndirectRef ref) { |