diff options
author | 2015-09-14 15:10:50 -0700 | |
---|---|---|
committer | 2015-09-15 10:33:03 -0700 | |
commit | d2bb5ba17c5760aee5347de3c32b4f2f47a33d54 (patch) | |
tree | 16cdbfc9f8a2c87b1453a63b882b28ec2c733c72 /runtime/gc/reference_queue.cc | |
parent | 5da1ea29be0d5f4e8fc03c3c509f0474b53affd2 (diff) |
Expect null referent in DequeuePendingReference().
Following up on CL 170735.
It's possible that the referent may potentially be cleared which would
cause a check failure. Avoid that.
Bug: 12687968
Bug: 23896462
Change-Id: I8ccc5936b61ceacf250624681e65307f23ce0405
Diffstat (limited to 'runtime/gc/reference_queue.cc')
-rw-r--r-- | runtime/gc/reference_queue.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/runtime/gc/reference_queue.cc b/runtime/gc/reference_queue.cc index 0c0ab6d212..56957baebf 100644 --- a/runtime/gc/reference_queue.cc +++ b/runtime/gc/reference_queue.cc @@ -115,10 +115,12 @@ mirror::Reference* ReferenceQueue::DequeuePendingReference() { << "ref=" << ref << " rb_ptr=" << ref->GetReadBarrierPointer(); } mirror::Object* referent = ref->GetReferent<kWithoutReadBarrier>(); - CHECK(referent != nullptr) << "Reference should not have been enqueued if referent is null"; - CHECK(concurrent_copying->IsInToSpace(referent)) - << "ref=" << ref << " rb_ptr=" << ref->GetReadBarrierPointer() - << " referent=" << referent; + // The referent could be null if it's cleared by a mutator (Reference.clear()). + if (referent != nullptr) { + CHECK(concurrent_copying->IsInToSpace(referent)) + << "ref=" << ref << " rb_ptr=" << ref->GetReadBarrierPointer() + << " referent=" << referent; + } } } return ref; |