Fix SkData leaks at GrResourceKey::setCustomData() call sites.
BUG=skia: TBR=bsalomon@google.com Review URL: https://codereview.chromium.org/1270103003 .
This commit is contained in:
parent
1d183b4cb3
commit
c369348aa5
@ -1489,7 +1489,8 @@ public:
|
|||||||
TessInfo info;
|
TessInfo info;
|
||||||
info.fTolerance = isLinear ? 0 : tol;
|
info.fTolerance = isLinear ? 0 : tol;
|
||||||
info.fCount = actualCount;
|
info.fCount = actualCount;
|
||||||
key->setCustomData(SkData::NewWithCopy(&info, sizeof(info)));
|
SkAutoTUnref<SkData> data(SkData::NewWithCopy(&info, sizeof(info)));
|
||||||
|
key->setCustomData(data.get());
|
||||||
resourceProvider->assignUniqueKeyToResource(*key, vertexBuffer.get());
|
resourceProvider->assignUniqueKeyToResource(*key, vertexBuffer.get());
|
||||||
SkPathPriv::AddGenIDChangeListener(fPath, SkNEW(PathInvalidator(*key)));
|
SkPathPriv::AddGenIDChangeListener(fPath, SkNEW(PathInvalidator(*key)));
|
||||||
}
|
}
|
||||||
|
@ -851,7 +851,8 @@ static void test_duplicate_unique_key(skiatest::Reporter* reporter) {
|
|||||||
make_unique_key<0>(&key2, 0);
|
make_unique_key<0>(&key2, 0);
|
||||||
SkAutoTUnref<TestResource> d(SkNEW_ARGS(TestResource, (context->getGpu())));
|
SkAutoTUnref<TestResource> d(SkNEW_ARGS(TestResource, (context->getGpu())));
|
||||||
int foo = 4132;
|
int foo = 4132;
|
||||||
key2.setCustomData(SkData::NewWithCopy(&foo, sizeof(foo)));
|
SkAutoTUnref<SkData> data(SkData::NewWithCopy(&foo, sizeof(foo)));
|
||||||
|
key2.setCustomData(data.get());
|
||||||
d->resourcePriv().setUniqueKey(key2);
|
d->resourcePriv().setUniqueKey(key2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1242,7 +1243,8 @@ static void test_custom_data(skiatest::Reporter* reporter) {
|
|||||||
make_unique_key<0>(&key1, 1);
|
make_unique_key<0>(&key1, 1);
|
||||||
make_unique_key<0>(&key2, 2);
|
make_unique_key<0>(&key2, 2);
|
||||||
int foo = 4132;
|
int foo = 4132;
|
||||||
key1.setCustomData(SkData::NewWithCopy(&foo, sizeof(foo)));
|
SkAutoTUnref<SkData> data(SkData::NewWithCopy(&foo, sizeof(foo)));
|
||||||
|
key1.setCustomData(data.get());
|
||||||
REPORTER_ASSERT(reporter, *(int*) key1.getCustomData()->data() == 4132);
|
REPORTER_ASSERT(reporter, *(int*) key1.getCustomData()->data() == 4132);
|
||||||
REPORTER_ASSERT(reporter, key2.getCustomData() == nullptr);
|
REPORTER_ASSERT(reporter, key2.getCustomData() == nullptr);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user