Merge "libutils: disallow extending lifetime on stack"

This commit is contained in:
Steven Moreland 2022-07-28 23:17:35 +00:00 committed by Gerrit Code Review
commit ea25b4ba5b

View file

@ -797,6 +797,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);