Commit 65e92099 authored by binzhang's avatar binzhang Committed by Bin Zhang
Browse files

sf: add lock to avoid race condition access.

mNameLayerMax = layer->getName() is called in SF onMessageReceived call,
and at the same time in BufferQueueLayer onFrameAvailable call, it can be
accessed at the same time through
frameInfo.max_queued_layer_name = mFlinger->mNameLayerMax.c_str();
because we add c_str() transition, then we need add lock to protect this
part.

add mMutex into getPreviousGfxInfo call to make sure fence info access
is correct.

in updateActiveBuffer call, the sp<> mActiveBuffer is updated, and sp
decStrong and incStrong are called,  at the same time in binder thread,
mActiveBuffer->getBounds() maybe called, we need add protection when we
use mActiveBuffer. Here we add one copy constructor call to make sure
the access is 100% correct without race condition. We don't need add mutex
to introduce additional overhead, smart pointer copy constructor call
can guarantee this.

Change-Id: I61ba00920f91bf39a27e31f65fa5378b355ecd23
CRs-Fixed: 2593130
parent 4f73fd3a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment