aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/core/SkRefCnt.h6
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) {