Fix leak in GLPrograms test.
TBR=joshualitt@google.com Review URL: https://codereview.chromium.org/648063002
This commit is contained in:
parent
09a1d6751c
commit
d27726eccb
@ -111,14 +111,15 @@ static GrRenderTarget* random_render_target(GrGpuGL* gpu,
|
||||
texDesc.fOrigin = random->nextBool() == true ? kTopLeft_GrSurfaceOrigin :
|
||||
kBottomLeft_GrSurfaceOrigin;
|
||||
|
||||
GrTexture* texture = gpu->getContext()->findAndRefTexture(texDesc, cacheId, ¶ms);
|
||||
if (NULL == texture) {
|
||||
texture = gpu->getContext()->createTexture(¶ms, texDesc, cacheId, 0, 0);
|
||||
if (NULL == texture) {
|
||||
SkAutoTUnref<GrTexture> texture(
|
||||
gpu->getContext()->findAndRefTexture(texDesc, cacheId, ¶ms));
|
||||
if (!texture) {
|
||||
texture.reset(gpu->getContext()->createTexture(¶ms, texDesc, cacheId, 0, 0));
|
||||
if (!texture) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return texture->asRenderTarget();
|
||||
return SkRef(texture->asRenderTarget());
|
||||
}
|
||||
|
||||
// TODO clean this up, we have to do this to test geometry processors but there has got to be
|
||||
@ -417,12 +418,11 @@ bool GrGpuGL::programUnitTest(int maxStages) {
|
||||
static const int NUM_TESTS = 512;
|
||||
for (int t = 0; t < NUM_TESTS;) {
|
||||
// setup random render target(can fail)
|
||||
GrRenderTarget* rtPtr = random_render_target(this, glProgramsCacheID, &random);
|
||||
if (!rtPtr) {
|
||||
SkAutoTUnref<GrRenderTarget> rt(random_render_target(this, glProgramsCacheID, &random));
|
||||
if (!rt) {
|
||||
SkDebugf("Could not allocate render target");
|
||||
return false;
|
||||
}
|
||||
GrTGpuResourceRef<GrRenderTarget> rt(SkRef(rtPtr), kWrite_GrIOType);
|
||||
|
||||
GrDrawState* ds = this->drawState();
|
||||
ds->setRenderTarget(rt.get());
|
||||
|
Loading…
Reference in New Issue
Block a user