Index: fpdfsdk/fpdf_flatten.cpp |
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp |
index de6baf1f01ca83b3ea43603a9c44dd903cc3a34e..aa192b91193bead043ca6c9eb73c49daac879764 100644 |
--- a/fpdfsdk/fpdf_flatten.cpp |
+++ b/fpdfsdk/fpdf_flatten.cpp |
@@ -194,7 +194,7 @@ void SetPageContents(CFX_ByteString key, |
// Create a new contents dictionary |
if (!key.IsEmpty()) { |
CPDF_Stream* pNewContents = |
- new CPDF_Stream(nullptr, 0, new CPDF_Dictionary); |
+ new CPDF_Stream(nullptr, 0, new CPDF_Dictionary(pDocument)); |
pPage->SetReferenceFor("Contents", pDocument, |
pDocument->AddIndirectObject(pNewContents)); |
@@ -207,7 +207,6 @@ void SetPageContents(CFX_ByteString key, |
} |
CPDF_Array* pContentsArray = nullptr; |
- |
switch (pContentsObj->GetType()) { |
case CPDF_Object::STREAM: { |
pContentsArray = new CPDF_Array; |
@@ -240,7 +239,7 @@ void SetPageContents(CFX_ByteString key, |
if (!key.IsEmpty()) { |
CPDF_Stream* pNewContents = |
- new CPDF_Stream(nullptr, 0, new CPDF_Dictionary); |
+ new CPDF_Stream(nullptr, 0, new CPDF_Dictionary(pDocument)); |
dwObjNum = pDocument->AddIndirectObject(pNewContents); |
pContentsArray->AddReference(pDocument, dwObjNum); |
@@ -373,15 +372,17 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { |
CPDF_Dictionary* pRes = pPageDict->GetDictFor("Resources"); |
if (!pRes) { |
- pRes = new CPDF_Dictionary; |
+ pRes = new CPDF_Dictionary(pDocument); |
dsinclair
2016/09/19 13:24:34
Reading through these, I think see
pRes = new
Tom Sepez
2016/09/19 18:24:59
Done.
|
pPageDict->SetFor("Resources", pRes); |
} |
- CPDF_Stream* pNewXObject = new CPDF_Stream(nullptr, 0, new CPDF_Dictionary); |
+ CPDF_Stream* pNewXObject = |
+ new CPDF_Stream(nullptr, 0, new CPDF_Dictionary(pDocument)); |
+ |
uint32_t dwObjNum = pDocument->AddIndirectObject(pNewXObject); |
CPDF_Dictionary* pPageXObject = pRes->GetDictFor("XObject"); |
if (!pPageXObject) { |
- pPageXObject = new CPDF_Dictionary; |
+ pPageXObject = new CPDF_Dictionary(pDocument); |
pRes->SetFor("XObject", pPageXObject); |
} |
@@ -405,7 +406,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { |
if (!key.IsEmpty()) { |
pPageXObject->SetReferenceFor(key, pDocument, dwObjNum); |
CPDF_Dictionary* pNewOXbjectDic = pNewXObject->GetDict(); |
- pNewXORes = new CPDF_Dictionary; |
+ pNewXORes = new CPDF_Dictionary(pDocument); |
pNewOXbjectDic->SetFor("Resources", pNewXORes); |
pNewOXbjectDic->SetNameFor("Type", "XObject"); |
pNewOXbjectDic->SetNameFor("Subtype", "Form"); |
@@ -477,7 +478,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { |
CPDF_Dictionary* pXObject = pNewXORes->GetDictFor("XObject"); |
if (!pXObject) { |
- pXObject = new CPDF_Dictionary; |
+ pXObject = new CPDF_Dictionary(pDocument); |
pNewXORes->SetFor("XObject", pXObject); |
} |