aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-02-06 12:47:14 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-02-06 12:47:14 +0000
commit3fda0eadac18dc3071e2bb2979512bd580b39ead (patch)
tree34a4da71759beee4ebb9fb80927e50d9ee60873c
parentae683921ffda9108147a29da7319c7eee4dc9245 (diff)
check for self-assignment in operator=
git-svn-id: http://skia.googlecode.com/svn/trunk@7610 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--include/utils/SkMatrix44.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/utils/SkMatrix44.h b/include/utils/SkMatrix44.h
index 41f1a30209..9d9b6e0102 100644
--- a/include/utils/SkMatrix44.h
+++ b/include/utils/SkMatrix44.h
@@ -125,8 +125,10 @@ public:
}
SkMatrix44& operator=(const SkMatrix44& src) {
- memcpy(fMat, src.fMat, sizeof(fMat));
- fTypeMask = src.fTypeMask;
+ if (&src != this) {
+ memcpy(fMat, src.fMat, sizeof(fMat));
+ fTypeMask = src.fTypeMask;
+ }
return *this;
}