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