diff options
author | Romain Guy <romainguy@google.com> | 2013-08-21 18:40:24 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2013-08-21 18:42:46 -0700 |
commit | 5d923200846ed59e813373bde789d97d4ccc40b5 (patch) | |
tree | db2f874cf61f812c4aa359f07d49525d8da82de8 /libs/hwui | |
parent | 0a8c51b1d0d66d6060afcec1eab33091d49332ae (diff) | |
download | frameworks_base-5d923200846ed59e813373bde789d97d4ccc40b5.zip frameworks_base-5d923200846ed59e813373bde789d97d4ccc40b5.tar.gz frameworks_base-5d923200846ed59e813373bde789d97d4ccc40b5.tar.bz2 |
Second attempt at avoiding infinite loop in PathCache::trim()
Bug #10347089
Change-Id: I70f5a3933e848632473acc6636c88be5dc6ac430
Diffstat (limited to 'libs/hwui')
-rw-r--r-- | libs/hwui/PathCache.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp index 25afe63..5df6408 100644 --- a/libs/hwui/PathCache.cpp +++ b/libs/hwui/PathCache.cpp @@ -214,7 +214,22 @@ void PathCache::operator()(PathDescription& entry, PathTexture*& texture) { void PathCache::removeTexture(PathTexture* texture) { if (texture) { const uint32_t size = texture->width * texture->height; - mSize -= size; + + // If there is a pending task we must wait for it to return + // before attempting our cleanup + const sp<Task<SkBitmap*> >& task = texture->task(); + if (task != NULL) { + SkBitmap* bitmap = task->getResult(); + texture->clearTask(); + } else { + // If there is a pending task, the path was not added + // to the cache and the size wasn't increased + if (size > mSize) { + ALOGE("Removing path texture of size %d will leave " + "the cache in an inconsistent state", size); + } + mSize -= size; + } PATH_LOGD("PathCache::delete name, size, mSize = %d, %d, %d", texture->id, size, mSize); |