summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/surfaceflinger_client/SharedBufferStack.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/libs/surfaceflinger_client/SharedBufferStack.cpp b/libs/surfaceflinger_client/SharedBufferStack.cpp
index 4a98026..5705748 100644
--- a/libs/surfaceflinger_client/SharedBufferStack.cpp
+++ b/libs/surfaceflinger_client/SharedBufferStack.cpp
@@ -560,6 +560,7 @@ status_t SharedBufferServer::resize(int newNumBuffers)
int base = numBuffers;
int32_t avail = stack.available;
int tail = head - avail + 1;
+
if (tail >= 0) {
int8_t* const index = const_cast<int8_t*>(stack.index);
const int nb = numBuffers - head;
@@ -573,8 +574,9 @@ status_t SharedBufferServer::resize(int newNumBuffers)
// fill the new free space with unused buffers
BufferList::const_iterator curr(mBufferList.free_begin());
for (int i=0 ; i<extra ; i++) {
- stack.index[base+i] = *curr++;
- mBufferList.add(stack.index[base+i]);
+ stack.index[base+i] = *curr;
+ mBufferList.add(*curr);
+ ++curr;
}
mNumBuffers = newNumBuffers;