diff options
author | bsalomon <bsalomon@google.com> | 2015-01-23 07:17:55 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-23 07:17:55 -0800 |
commit | 4dffede04afd6432ffd406b5ba875db8a698dd4a (patch) | |
tree | 0d159cf618d2a4397db4c56ba386312e55cdbf7d /include | |
parent | 727c594d4ba3ba9183ff383f1450e01ece651d6b (diff) |
Fix self assigment in GrResourceKey
TBR=robertphillips@google.com
BUG=skia:3340
Review URL: https://codereview.chromium.org/866263007
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/GrResourceKey.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/gpu/GrResourceKey.h b/include/gpu/GrResourceKey.h index d500a65657..15d7b439f1 100644 --- a/include/gpu/GrResourceKey.h +++ b/include/gpu/GrResourceKey.h @@ -49,10 +49,12 @@ protected: } GrResourceKey& operator=(const GrResourceKey& that) { - size_t bytes = that.size(); - SkASSERT(SkIsAlign4(bytes)); - fKey.reset(SkToInt(bytes / sizeof(uint32_t))); - memcpy(fKey.get(), that.fKey.get(), bytes); + if (this != &that) { + size_t bytes = that.size(); + SkASSERT(SkIsAlign4(bytes)); + fKey.reset(SkToInt(bytes / sizeof(uint32_t))); + memcpy(fKey.get(), that.fKey.get(), bytes); + } return *this; } |