summaryrefslogtreecommitdiff
path: root/core/fxcrt/include/fx_basic.h
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-05-19 14:36:00 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-19 14:36:00 -0700
commit80f25a5a8135933a405349ffc798d13273b3d690 (patch)
treedb15a1e0c751f6fc0a648a991d744bc14e7bfadd /core/fxcrt/include/fx_basic.h
parentc7600f99490f83e544e37feb77d3b9e8428b0f68 (diff)
downloadpdfium-80f25a5a8135933a405349ffc798d13273b3d690.tar.xz
Fix leak in CPDF_StreamContentParser::AddTextObject().
... by using STL containers in more places. Remove dead / duplicate code as well. BUG=603904 Review-Url: https://codereview.chromium.org/1998583002
Diffstat (limited to 'core/fxcrt/include/fx_basic.h')
-rw-r--r--core/fxcrt/include/fx_basic.h39
1 files changed, 4 insertions, 35 deletions
diff --git a/core/fxcrt/include/fx_basic.h b/core/fxcrt/include/fx_basic.h
index 1835d9e0a6..7fdfbf699d 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; }