diff options
Diffstat (limited to 'include/core/SkRefCnt.h')
-rw-r--r-- | include/core/SkRefCnt.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h index 87ff7dba9f..35f7349778 100644 --- a/include/core/SkRefCnt.h +++ b/include/core/SkRefCnt.h @@ -160,6 +160,13 @@ template <typename T> static inline void SkSafeUnref(T* obj) { } } +template<typename T> static inline void SkSafeSetNull(T*& obj) { + if (NULL != obj) { + obj->unref(); + obj = NULL; + } +} + /////////////////////////////////////////////////////////////////////////////// /** |