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

Commit 41cdd757 authored by Chavi Weingarten's avatar Chavi Weingarten Committed by Automerger Merge Worker
Browse files

Merge "Hold mMutex lock and check abandoned when accessing mLayer" into...

Merge "Hold mMutex lock and check abandoned when accessing mLayer" into rvc-dev am: a38a3e14 am: a026ce70 am: 5d9d7c2c am: a742ae0e

Change-Id: I23b12d3db490a03d135b90678a586c29e99b13ff
parents 1c8dea4d a742ae0e
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line Diff line number Diff line
@@ -452,6 +452,13 @@ void BufferLayerConsumer::freeBufferLocked(int slotIndex) {
}
}


void BufferLayerConsumer::onDisconnect() {
void BufferLayerConsumer::onDisconnect() {
    Mutex::Autolock lock(mMutex);

    if (mAbandoned) {
        // Nothing to do if we're already abandoned.
        return;
    }

    mLayer->onDisconnect();
    mLayer->onDisconnect();
}
}


@@ -486,6 +493,13 @@ void BufferLayerConsumer::onBufferAvailable(const BufferItem& item) {


void BufferLayerConsumer::addAndGetFrameTimestamps(const NewFrameEventsEntry* newTimestamps,
void BufferLayerConsumer::addAndGetFrameTimestamps(const NewFrameEventsEntry* newTimestamps,
                                                   FrameEventHistoryDelta* outDelta) {
                                                   FrameEventHistoryDelta* outDelta) {
    Mutex::Autolock lock(mMutex);

    if (mAbandoned) {
        // Nothing to do if we're already abandoned.
        return;
    }

    mLayer->addAndGetFrameTimestamps(newTimestamps, outDelta);
    mLayer->addAndGetFrameTimestamps(newTimestamps, outDelta);
}
}


+2 −2
Original line number Original line Diff line number Diff line
@@ -331,8 +331,8 @@ private:
    // construction time.
    // construction time.
    const uint32_t mTexName;
    const uint32_t mTexName;


    // The layer for this BufferLayerConsumer
    // The layer for this BufferLayerConsumer. Always check mAbandoned before accessing.
    Layer* mLayer;
    Layer* mLayer GUARDED_BY(mMutex);


    wp<ContentsChangedListener> mContentsChangedListener;
    wp<ContentsChangedListener> mContentsChangedListener;