aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-01-23 07:17:55 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-23 07:17:55 -0800
commit4dffede04afd6432ffd406b5ba875db8a698dd4a (patch)
tree0d159cf618d2a4397db4c56ba386312e55cdbf7d /include
parent727c594d4ba3ba9183ff383f1450e01ece651d6b (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.h10
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;
}