aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-31 20:22:47 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-31 20:22:47 +0000
commit3843f3fc8907083f4d4d777fa1d4e4ea0060a351 (patch)
tree1b9fb2eebcaac3d6b1bdef80d4fcf10124f92828 /src/gpu
parent908f1270c7c56cca7f1571b6e5e4102f9fe32bc9 (diff)
Partial fix for Skia issue 1769: GenerateGMs crashing (out of memory)
GenerateGMs was crashing because we were adding genID listeners for textures even when creation failed -- in this case the key generated is not valid, so when it comes time to purge it, it triggers an assert and then an apparent crash. The solution is to not add a genID listener in this case. This doesn't solve the problem of running out of memory, it just prevents it from causing a crash in Debug builds. BUG= R=bsalomon@google.com, robertphillips@google.com, mtklein@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/55023005 git-svn-id: http://skia.googlecode.com/svn/trunk@12062 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/SkGr.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 18c54ef3c2..c7ae0c8f36 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -141,7 +141,9 @@ static GrTexture* sk_gr_create_bitmap_texture(GrContext* ctx,
GrResourceKey key;
GrTexture* result = ctx->createTexture(params, desc, cacheID,
storage.get(), bitmap->width(), &key);
- add_genID_listener(key, origBitmap.pixelRef());
+ if (NULL != result) {
+ add_genID_listener(key, origBitmap.pixelRef());
+ }
return result;
} else {
GrTexture* result = ctx->lockAndRefScratchTexture(desc,
@@ -171,7 +173,9 @@ static GrTexture* sk_gr_create_bitmap_texture(GrContext* ctx,
GrResourceKey key;
GrTexture* result = ctx->createTexture(params, desc, cacheID,
bitmap->getPixels(), bitmap->rowBytes(), &key);
- add_genID_listener(key, origBitmap.pixelRef());
+ if (NULL != result) {
+ add_genID_listener(key, origBitmap.pixelRef());
+ }
return result;
} else {
// This texture is unlikely to be used again (in its present form) so