diff options
author | tsepez <tsepez@chromium.org> | 2016-11-04 11:38:40 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-04 11:38:40 -0700 |
commit | 33fdebc3da676bff84d0fd0f69b9087c0c12dfeb (patch) | |
tree | 274499f6bc4df60ebb57a52bf78b82180ea52295 /core/fpdfapi/parser/cpdf_array.cpp | |
parent | 761eed284e1248f851fbb23beaa45835b644ecee (diff) | |
download | pdfium-33fdebc3da676bff84d0fd0f69b9087c0c12dfeb.tar.xz |
Reland "Remove CPDF_Object::Release() in favor of direct delete"
This reverts commit f0d5b6c35fa343108a3ab7a25bc2cc2b3cf105b3.
Review-Url: https://codereview.chromium.org/2478303002
Diffstat (limited to 'core/fpdfapi/parser/cpdf_array.cpp')
-rw-r--r-- | core/fpdfapi/parser/cpdf_array.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/core/fpdfapi/parser/cpdf_array.cpp b/core/fpdfapi/parser/cpdf_array.cpp index e118fd66e6..4000bbc980 100644 --- a/core/fpdfapi/parser/cpdf_array.cpp +++ b/core/fpdfapi/parser/cpdf_array.cpp @@ -24,7 +24,7 @@ CPDF_Array::~CPDF_Array() { m_ObjNum = kInvalidObjNum; for (auto& it : m_Objects) { if (it && it->GetObjNum() != kInvalidObjNum) - it->Release(); + delete it; } } @@ -139,10 +139,9 @@ void CPDF_Array::RemoveAt(size_t i, size_t nCount) { if (nCount <= 0 || nCount > m_Objects.size() - i) return; - for (size_t j = 0; j < nCount; ++j) { - if (CPDF_Object* p = m_Objects[i + j]) - p->Release(); - } + for (size_t j = 0; j < nCount; ++j) + delete m_Objects[i + j]; + m_Objects.erase(m_Objects.begin() + i, m_Objects.begin() + i + nCount); } @@ -166,9 +165,7 @@ void CPDF_Array::SetAt(size_t i, CPDF_Object* pObj) { ASSERT(false); return; } - if (CPDF_Object* pOld = m_Objects[i]) - pOld->Release(); - + delete m_Objects[i]; m_Objects[i] = pObj; } |