diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-11-27 17:20:39 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-11-27 17:20:39 +0000 |
commit | 4efd9d9872420b40f618294a0db4bbf7f70405d2 (patch) | |
tree | 674a5c0aa6fac7dbe7586075c6b9bf7ba4b73161 /include | |
parent | 26daa8bbeee92fb763de4f3885a5193d4ab2c827 (diff) |
guard for self-assignment in reset()
git-svn-id: http://skia.googlecode.com/svn/trunk@6568 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkRefCnt.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h index 3a0f8be383..2d183cd844 100644 --- a/include/core/SkRefCnt.h +++ b/include/core/SkRefCnt.h @@ -155,8 +155,10 @@ public: T* get() const { return fObj; } void reset(T* obj) { - SkSafeUnref(fObj); - fObj = obj; + if (obj != fObj) { + SkSafeUnref(fObj); + fObj = obj; + } } void swap(SkAutoTUnref* other) { |