Index: fpdfsdk/cpdfsdk_baannot.cpp |
diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp |
index 72468e180ffe38fc6b688da688e536e0f5e5505d..ad9b8cf9bdf98fc18121f524f51af02b8b2ac20a 100644 |
--- a/fpdfsdk/cpdfsdk_baannot.cpp |
+++ b/fpdfsdk/cpdfsdk_baannot.cpp |
@@ -316,10 +316,9 @@ void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType, |
} |
if (!pStream) { |
- pStream = new CPDF_Stream; |
CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); |
- pParentDict->SetReferenceFor(sAPType, pDoc, |
- pDoc->AddIndirectObject(pStream)); |
+ pStream = pDoc->AddIndirectStream(); |
+ pParentDict->SetReferenceFor(sAPType, pDoc, pStream); |
} |
CPDF_Dictionary* pStreamDict = pStream->GetDict(); |
@@ -354,8 +353,9 @@ void CPDFSDK_BAAnnot::SetAction(const CPDF_Action& action) { |
CPDF_Dictionary* pDict = action.GetDict(); |
if (pDict != m_pAnnot->GetAnnotDict()->GetDictFor("A")) { |
CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); |
- m_pAnnot->GetAnnotDict()->SetReferenceFor("A", pDoc, |
- pDoc->AddIndirectObject(pDict)); |
+ m_pAnnot->GetAnnotDict()->SetReferenceFor( |
+ "A", pDoc, |
+ pDoc->AddIndirectObject(UniqueDictionary(pDict))); // Owner? |
} |
} |