diff options
| author | 2016-04-27 20:11:26 +0000 | |
|---|---|---|
| committer | 2016-04-27 20:11:26 +0000 | |
| commit | 44e9c027958ef5d7f8c8a06137ff9832b43114fb (patch) | |
| tree | 98f0b9c9092f844d9290de378ac2baffe22c9f38 /libs/gui/BufferQueueProducer.cpp | |
| parent | 8335fa3f500addd8804869388fd91d776aa56188 (diff) | |
| parent | 87e94cd1d16281051d5241a25035aa1db0b073d8 (diff) | |
Merge "Fix use of invalid iterator." into nyc-dev
Diffstat (limited to 'libs/gui/BufferQueueProducer.cpp')
| -rw-r--r-- | libs/gui/BufferQueueProducer.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp index 0b7ce174fe..73f61c5e98 100644 --- a/libs/gui/BufferQueueProducer.cpp +++ b/libs/gui/BufferQueueProducer.cpp @@ -1280,11 +1280,14 @@ void BufferQueueProducer::allocateBuffers(uint32_t width, uint32_t height, // freeBufferLocked puts this slot on the free slots list. Since // we then attached a buffer, move the slot to free buffer list. - mCore->mFreeSlots.erase(slot); mCore->mFreeBuffers.push_front(*slot); BQ_LOGV("allocateBuffers: allocated a new buffer in slot %d", *slot); + + // Make sure the erase is done after all uses of the slot + // iterator since it will be invalid after this point. + mCore->mFreeSlots.erase(slot); } mCore->mIsAllocating = false; |