summaryrefslogtreecommitdiff
path: root/core/fpdfapi/edit
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-04 08:25:34 -0700
committerCommit bot <commit-bot@chromium.org>2016-11-04 08:25:34 -0700
commitf0d5b6c35fa343108a3ab7a25bc2cc2b3cf105b3 (patch)
treeedc3d5f35225971679e581c8ef951de8275a944b /core/fpdfapi/edit
parent4de3d095c9d9e961f93750cf1ebd489fd515be12 (diff)
downloadpdfium-f0d5b6c35fa343108a3ab7a25bc2cc2b3cf105b3.tar.xz
Revert of Remove CPDF_Object::Release() in favor of direct delete (patchset #11 id:200001 of https://codereview.chromium.org/2384883003/ )
Reason for revert: Looks like it's blocking the roll. https://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_compile_dbg_ng/builds/186619 Original issue's description: > Remove CPDF_Object::Release() in favor of direct delete > > Follow-on once we prove Release always deletes in previous CL. > > Committed: https://pdfium.googlesource.com/pdfium/+/4de3d095c9d9e961f93750cf1ebd489fd515be12 TBR=thestig@chromium.org,tsepez@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review-Url: https://codereview.chromium.org/2478253002
Diffstat (limited to 'core/fpdfapi/edit')
-rw-r--r--core/fpdfapi/edit/cpdf_creator.h2
-rw-r--r--core/fpdfapi/edit/fpdf_edit_create.cpp14
2 files changed, 8 insertions, 8 deletions
diff --git a/core/fpdfapi/edit/cpdf_creator.h b/core/fpdfapi/edit/cpdf_creator.h
index c04db6eb37..f462115cf7 100644
--- a/core/fpdfapi/edit/cpdf_creator.h
+++ b/core/fpdfapi/edit/cpdf_creator.h
@@ -94,7 +94,7 @@ class CPDF_Creator {
FX_FILESIZE m_XrefStart;
CFX_FileSizeListArray m_ObjectOffset;
CFX_ArrayTemplate<uint32_t> m_NewObjNumArray;
- std::unique_ptr<CPDF_Array> m_pIDArray;
+ std::unique_ptr<CPDF_Array, ReleaseDeleter<CPDF_Array>> m_pIDArray;
int32_t m_FileVersion;
};
diff --git a/core/fpdfapi/edit/fpdf_edit_create.cpp b/core/fpdfapi/edit/fpdf_edit_create.cpp
index a578a0a114..ed638d4c40 100644
--- a/core/fpdfapi/edit/fpdf_edit_create.cpp
+++ b/core/fpdfapi/edit/fpdf_edit_create.cpp
@@ -470,8 +470,8 @@ CPDF_FlateEncoder::CPDF_FlateEncoder(const uint8_t* pBuffer,
}
CPDF_FlateEncoder::~CPDF_FlateEncoder() {
- if (m_bCloned)
- delete m_pDict;
+ if (m_bCloned && m_pDict)
+ m_pDict->Release();
if (m_bNewData)
FX_Free(m_pData);
}
@@ -902,8 +902,8 @@ CPDF_Creator::CPDF_Creator(CPDF_Document* pDoc)
CPDF_Creator::~CPDF_Creator() {
ResetStandardSecurity();
- if (m_bEncryptCloned) {
- delete m_pEncryptDict;
+ if (m_bEncryptCloned && m_pEncryptDict) {
+ m_pEncryptDict->Release();
m_pEncryptDict = nullptr;
}
Clear();
@@ -1247,7 +1247,7 @@ int32_t CPDF_Creator::WriteOldIndirectObject(uint32_t objnum) {
return -1;
}
if (!bExistInMap) {
- m_pDocument->DeleteIndirectObject(objnum);
+ m_pDocument->ReleaseIndirectObject(objnum);
}
} else {
uint8_t* pBuffer;
@@ -1934,7 +1934,7 @@ void CPDF_Creator::InitID(bool bDefault) {
m_pIDArray->Add(pID1->Clone());
} else {
std::vector<uint8_t> buffer =
- PDF_GenerateFileID((uint32_t)(uintptr_t) this, m_dwLastObjNum);
+ PDF_GenerateFileID((uint32_t)(uintptr_t)this, m_dwLastObjNum);
CFX_ByteString bsBuffer(buffer.data(), buffer.size());
m_pIDArray->Add(new CPDF_String(bsBuffer, true));
}
@@ -1949,7 +1949,7 @@ void CPDF_Creator::InitID(bool bDefault) {
return;
}
std::vector<uint8_t> buffer =
- PDF_GenerateFileID((uint32_t)(uintptr_t) this, m_dwLastObjNum);
+ PDF_GenerateFileID((uint32_t)(uintptr_t)this, m_dwLastObjNum);
CFX_ByteString bsBuffer(buffer.data(), buffer.size());
m_pIDArray->Add(new CPDF_String(bsBuffer, true));
return;