Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: include/core/SkRefCnt.h

Issue 1767983002: Fix behavior of sk_sp::reset() and add unittest. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use unique() correctly Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/RefCntTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkRefCnt.h
diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h
index 9b05ad49698cb2b6ea15f84e670b24492d0eff9e..d33117751e0717943ec28b890bd645e98ff8f6bc 100644
--- a/include/core/SkRefCnt.h
+++ b/include/core/SkRefCnt.h
@@ -338,10 +338,8 @@ public:
* No call to ref() will be made.
*/
void reset(T* ptr = nullptr) {
- if (fPtr != ptr) {
- SkSafeUnref(fPtr);
- fPtr = ptr;
- }
+ SkSafeUnref(fPtr);
+ fPtr = ptr;
}
/**
« no previous file with comments | « no previous file | tests/RefCntTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698