From 04bc12bd4316e2928134037cd0f81c6d8b2adcc8 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Fri, 21 Aug 2009 15:44:17 -0700 Subject: fix [2070341] [FAST BLOCKER] can't successfully setup erc52 --- libs/ui/Surface.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'libs') diff --git a/libs/ui/Surface.cpp b/libs/ui/Surface.cpp index 36a10cf..474308a 100644 --- a/libs/ui/Surface.cpp +++ b/libs/ui/Surface.cpp @@ -602,7 +602,18 @@ int Surface::dequeueBuffer(android_native_buffer_t** buffer) mBackbufferIndex = backIdx; layer_cblk_t* const lcblk = &(cblk->layers[index]); volatile const surface_info_t* const back = lcblk->surface + backIdx; - if ((back->flags & surface_info_t::eNeedNewBuffer) || mUsageChanged) { + + const sp& backBuffer(mBuffers[backIdx]); + + if (backBuffer==0 && + !((back->flags & surface_info_t::eNeedNewBuffer) || mUsageChanged)) { + LOGW("dequeueBuffer: backbuffer is null, but eNeedNewBuffer " + "is not set, fetching a buffer anyways..."); + } + + if ((back->flags & surface_info_t::eNeedNewBuffer) ||mUsageChanged || + backBuffer==0) + { mUsageChanged = false; err = getBufferLocked(backIdx, mUsage); if (err == NO_ERROR) { @@ -614,7 +625,6 @@ int Surface::dequeueBuffer(android_native_buffer_t** buffer) } if (err == NO_ERROR) { - const sp& backBuffer(mBuffers[backIdx]); if (backBuffer != 0) { mDirtyRegion.set(backBuffer->width, backBuffer->height); *buffer = backBuffer.get(); -- cgit v1.1