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

Unified Diff: fpdfsdk/cpdfsdk_baannot.cpp

Issue 2419173002: Update CPDF_IndirectObjectHolder APIs for unique objects (Closed)
Patch Set: Fix issues Created 4 years, 2 months 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/fpdfdoc/cpvt_generateap.cpp ('k') | fpdfsdk/cpdfsdk_widget.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/cpdfsdk_baannot.cpp
diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp
index 72468e180ffe38fc6b688da688e536e0f5e5505d..e704822e4d747903e6757c308a51eecf0f4b0368 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,10 @@ 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));
+
+ // TODO(tsepez): check |pDict| ownership.
+ m_pAnnot->GetAnnotDict()->SetReferenceFor(
+ "A", pDoc, pDoc->AddIndirectObject(UniqueDictionary(pDict)));
}
}
« no previous file with comments | « core/fpdfdoc/cpvt_generateap.cpp ('k') | fpdfsdk/cpdfsdk_widget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698