Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d086fe51 authored by Steven Moreland's avatar Steven Moreland
Browse files

libutils: disallow extending lifetime on stack

Bug: 232557259
Test: libutils_test
Change-Id: Iacf45b9f295a48904606ced35994ba35566bfcc3
parent c340a08b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);