Fix leak of GrResourceCacheEntry

R=robertphillips@google.com
TBR=robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/502543002
This commit is contained in:
bsalomon 2014-08-22 12:01:46 -07:00 committed by Commit bot
parent 84cab93186
commit 02e36f2d3f
2 changed files with 4 additions and 2 deletions

View File

@ -548,8 +548,9 @@ void GrContext::unlockScratchTexture(GrTexture* texture) {
if (texture->wasDestroyed()) {
if (texture->getCacheEntry()->key().isScratch()) {
// This texture was detached from the cache but the cache still had a ref to it but
// not a pointer to it.
texture->unref();
// not a pointer to it. This will unref the texture and delete its resource cache
// entry.
delete texture->getCacheEntry();
}
return;
}

View File

@ -152,6 +152,7 @@ private:
SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrResourceCacheEntry);
friend class GrResourceCache;
friend class GrContext;
};
///////////////////////////////////////////////////////////////////////////////