Chromium Code Reviews| Index: fpdfsdk/cpdfsdk_baannot.cpp |
| diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp |
| index 0e6c53cc78f99c47deb792dd964315bf72b47ccf..44e45285cb7fc8428770861de805e5c32f562252 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->NewIndirect<CPDF_Stream>(); |
| + pParentDict->SetReferenceFor(sAPType, pDoc, pStream); |
| } |
| CPDF_Dictionary* pStreamDict = pStream->GetDict(); |
| @@ -353,9 +352,9 @@ CPDF_Action CPDFSDK_BAAnnot::GetAction() const { |
| 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)); |
| + CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); // OWNERSHIP ??? |
|
dsinclair
2016/11/15 18:55:51
not sure what the comment means?
Tom Sepez
2016/11/15 19:15:16
It was a reminder for me to check this again. Remo
|
| + pDict = pDoc->AddIndirectObject(pDict->Clone())->AsDictionary(); |
| + m_pAnnot->GetAnnotDict()->SetReferenceFor("A", pDoc, pDict); |
| } |
| } |