| Index: core/fxcrt/include/fx_basic.h
|
| diff --git a/core/fxcrt/include/fx_basic.h b/core/fxcrt/include/fx_basic.h
|
| index 1835d9e0a6d5cb6ab75dca07d275f6bcd3310d03..7fdfbf699dd7406567dc6547822feabb38194a4d 100644
|
| --- a/core/fxcrt/include/fx_basic.h
|
| +++ b/core/fxcrt/include/fx_basic.h
|
| @@ -717,53 +717,22 @@ class CFX_CountRef {
|
| }
|
| }
|
|
|
| - ~CFX_CountRef() {
|
| - if (!m_pObject) {
|
| - return;
|
| - }
|
| - m_pObject->m_RefCount--;
|
| - if (m_pObject->m_RefCount <= 0) {
|
| - delete m_pObject;
|
| - }
|
| - }
|
| + ~CFX_CountRef() { SetNull(); }
|
|
|
| ObjClass* New() {
|
| - if (m_pObject) {
|
| - m_pObject->m_RefCount--;
|
| - if (m_pObject->m_RefCount <= 0) {
|
| - delete m_pObject;
|
| - }
|
| - }
|
| + SetNull();
|
| m_pObject = new CountedObj;
|
| m_pObject->m_RefCount = 1;
|
| return m_pObject;
|
| }
|
|
|
| void operator=(const Ref& ref) {
|
| - if (ref.m_pObject) {
|
| + if (ref.m_pObject)
|
| ref.m_pObject->m_RefCount++;
|
| - }
|
| - if (m_pObject) {
|
| - m_pObject->m_RefCount--;
|
| - if (m_pObject->m_RefCount <= 0) {
|
| - delete m_pObject;
|
| - }
|
| - }
|
| + SetNull();
|
| m_pObject = ref.m_pObject;
|
| }
|
|
|
| - void operator=(void* p) {
|
| - ASSERT(p == 0);
|
| - if (!m_pObject) {
|
| - return;
|
| - }
|
| - m_pObject->m_RefCount--;
|
| - if (m_pObject->m_RefCount <= 0) {
|
| - delete m_pObject;
|
| - }
|
| - m_pObject = NULL;
|
| - }
|
| -
|
| const ObjClass* GetObject() const { return m_pObject; }
|
|
|
| operator const ObjClass*() const { return m_pObject; }
|
|
|