Index: core/fxcrt/include/cfx_count_ref.h |
diff --git a/core/fxcrt/include/cfx_count_ref.h b/core/fxcrt/include/cfx_count_ref.h |
index d709efb67c0c9d1d64554d507ad0892ec3063c4b..6ad68864d7d691e5159ad8d8f4dcabeb85734d12 100644 |
--- a/core/fxcrt/include/cfx_count_ref.h |
+++ b/core/fxcrt/include/cfx_count_ref.h |
@@ -56,11 +56,13 @@ class CFX_CountRef { |
CountedObj(Args... params) : ObjClass(params...), m_RefCount(0) {} |
CountedObj(const CountedObj& src) : ObjClass(src), m_RefCount(0) {} |
+ ~CountedObj() { m_RefCount = 0; } |
bool HasOneRef() const { return m_RefCount == 1; } |
void Retain() { m_RefCount++; } |
void Release() { |
- if (--m_RefCount <= 0) |
+ ASSERT(m_RefCount); |
+ if (--m_RefCount == 0) |
delete this; |
} |