diff options
-rw-r--r-- | services/surfaceflinger/Layer.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 3e932df..6a9cdb7 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -1448,11 +1448,16 @@ Region Layer::latchBuffer(bool& recomputeVisibleRegions) // Remove any stale buffers that have been dropped during // updateTexImage - while (mQueueItems[0].mFrameNumber != currentFrameNumber) { + while ((mQueuedFrames > 0) && (mQueueItems[0].mFrameNumber != currentFrameNumber)) { mQueueItems.removeAt(0); android_atomic_dec(&mQueuedFrames); } + if (mQueuedFrames == 0) { + ALOGE("[%s] mQueuedFrames is zero !!", mName.string()); + return outDirtyRegion; + } + mQueueItems.removeAt(0); } |