Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1742)

Unified Diff: core/fpdfapi/parser/cpdf_array.cpp

Issue 2478253002: Revert of Remove CPDF_Object::Release() in favor of direct delete (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/parser/cpdf_array.h ('k') | core/fpdfapi/parser/cpdf_array_unittest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/parser/cpdf_array.cpp
diff --git a/core/fpdfapi/parser/cpdf_array.cpp b/core/fpdfapi/parser/cpdf_array.cpp
index 4000bbc98088e3fecf7531f020a7093fd9fc54c9..e118fd66e6c2ff5892c1fae9c90d77f32851b009 100644
--- a/core/fpdfapi/parser/cpdf_array.cpp
+++ b/core/fpdfapi/parser/cpdf_array.cpp
@@ -24,7 +24,7 @@
m_ObjNum = kInvalidObjNum;
for (auto& it : m_Objects) {
if (it && it->GetObjNum() != kInvalidObjNum)
- delete it;
+ it->Release();
}
}
@@ -139,9 +139,10 @@
if (nCount <= 0 || nCount > m_Objects.size() - i)
return;
- for (size_t j = 0; j < nCount; ++j)
- delete m_Objects[i + j];
-
+ for (size_t j = 0; j < nCount; ++j) {
+ if (CPDF_Object* p = m_Objects[i + j])
+ p->Release();
+ }
m_Objects.erase(m_Objects.begin() + i, m_Objects.begin() + i + nCount);
}
@@ -165,7 +166,9 @@
ASSERT(false);
return;
}
- delete m_Objects[i];
+ if (CPDF_Object* pOld = m_Objects[i])
+ pOld->Release();
+
m_Objects[i] = pObj;
}
« no previous file with comments | « core/fpdfapi/parser/cpdf_array.h ('k') | core/fpdfapi/parser/cpdf_array_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698