diff options
author | scroggo <scroggo@google.com> | 2016-02-16 06:59:18 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-16 06:59:18 -0800 |
commit | 9dec5d2acdd12202a1f0ed571cb5ecee574a2550 (patch) | |
tree | 5fb47683c5b261c85f88a54f4f29732059e832c1 /tests | |
parent | ddd22d86455d95941ea21253b210819c1d4a3863 (diff) |
Make SkRWBuffer destruct safely
Check for NULL before calling unref.
Add a test.
BUG=483369
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1691383002
Review URL: https://codereview.chromium.org/1691383002
Diffstat (limited to 'tests')
-rw-r--r-- | tests/DataRefTest.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/DataRefTest.cpp b/tests/DataRefTest.cpp index f1e645ec7e..a474019e92 100644 --- a/tests/DataRefTest.cpp +++ b/tests/DataRefTest.cpp @@ -328,3 +328,10 @@ DEF_TEST(RWBuffer_size, r) { REPORTER_ASSERT(r, !iter.next()); REPORTER_ASSERT(r, 0 == iter.size()); } + +// Tests that it is safe to destruct an SkRWBuffer without appending +// anything to it. +DEF_TEST(RWBuffer_noAppend, r) { + SkRWBuffer buffer; + REPORTER_ASSERT(r, 0 == buffer.size()); +} |