guard for self-assignment in reset()

git-svn-id: http://skia.googlecode.com/svn/trunk@6568 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2012-11-27 17:20:39 +00:00
parent 26daa8bbee
commit 4efd9d9872

View File

@ -155,8 +155,10 @@ public:
T* get() const { return fObj; } T* get() const { return fObj; }
void reset(T* obj) { void reset(T* obj) {
SkSafeUnref(fObj); if (obj != fObj) {
fObj = obj; SkSafeUnref(fObj);
fObj = obj;
}
} }
void swap(SkAutoTUnref* other) { void swap(SkAutoTUnref* other) {