libutils: disallow extending lifetime on stack
Bug: 232557259 Test: libutils_test Change-Id: Iacf45b9f295a48904606ced35994ba35566bfcc3
This commit is contained in:
parent
c340a08b1b
commit
d086fe5109
1 changed files with 2 additions and 0 deletions
|
@ -791,6 +791,8 @@ RefBase::~RefBase()
|
|||
|
||||
void RefBase::extendObjectLifetime(int32_t mode)
|
||||
{
|
||||
check_not_on_stack(this);
|
||||
|
||||
// Must be happens-before ordered with respect to construction or any
|
||||
// operation that could destroy the object.
|
||||
mRefs->mFlags.fetch_or(mode, std::memory_order_relaxed);
|
||||
|
|
Loading…
Reference in a new issue