diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-09-12 19:54:12 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-09-12 19:54:12 +0000 |
commit | 4c888aae25c1f6a420caceec7c42736ba6ddad3d (patch) | |
tree | 2f675ad4a595163cb1390d2e26adbf102c890730 /include/core | |
parent | 66d57255ad984f8926e4ed9d45bfb00cdfc90f4e (diff) |
write 0 to our refcnt in the destructor, in the off-chance of it helping us
catch reuse-after-delete bugs (debug only)
git-svn-id: http://skia.googlecode.com/svn/trunk@2251 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkRefCnt.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h index 4c9376b44a..7af00178c7 100644 --- a/include/core/SkRefCnt.h +++ b/include/core/SkRefCnt.h @@ -30,7 +30,12 @@ public: /** Destruct, asserting that the reference count is 1. */ - virtual ~SkRefCnt() { SkASSERT(fRefCnt == 1); } + virtual ~SkRefCnt() { +#ifdef SK_DEBUG + SkASSERT(fRefCnt == 1); + fRefCnt = 0; // illegal value, to catch us if we reuse after delete +#endif + } /** Return the reference count. */ |