diff options
author | tsepez <tsepez@chromium.org> | 2016-10-14 16:59:10 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-14 16:59:10 -0700 |
commit | 3ba098595ae56b64eacc0c25ab76b89a4d78d920 (patch) | |
tree | 5c4db47295ea64cdf236c32ef7d5af5b8e7af232 /core/fpdfapi/page/cpdf_docpagedata.cpp | |
parent | 1d023881cd53485303c0fcc0b5878e700dc470fd (diff) | |
download | pdfium-3ba098595ae56b64eacc0c25ab76b89a4d78d920.tar.xz |
Update CPDF_IndirectObjectHolder APIs for unique objects.
Doing so highlights a few places where ownership is dubious.
Add convenience functions to return an unowned reference to
a newly-created indirect object.
Review-Url: https://codereview.chromium.org/2419173002
Diffstat (limited to 'core/fpdfapi/page/cpdf_docpagedata.cpp')
-rw-r--r-- | core/fpdfapi/page/cpdf_docpagedata.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/fpdfapi/page/cpdf_docpagedata.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp index 5f1f561ebb..0114c680f2 100644 --- a/core/fpdfapi/page/cpdf_docpagedata.cpp +++ b/core/fpdfapi/page/cpdf_docpagedata.cpp @@ -175,7 +175,8 @@ CPDF_Font* CPDF_DocPageData::GetStandardFont(const CFX_ByteString& fontName, return fontData->AddRef(); } - CPDF_Dictionary* pDict = new CPDF_Dictionary(m_pPDFDoc->GetByteStringPool()); + CPDF_Dictionary* pDict = + m_pPDFDoc->AddIndirectDictionary(m_pPDFDoc->GetByteStringPool()); pDict->SetNameFor("Type", "Font"); pDict->SetNameFor("Subtype", "Type1"); pDict->SetNameFor("BaseFont", fontName); @@ -183,7 +184,6 @@ CPDF_Font* CPDF_DocPageData::GetStandardFont(const CFX_ByteString& fontName, pDict->SetFor("Encoding", pEncoding->Realize(m_pPDFDoc->GetByteStringPool())); } - m_pPDFDoc->AddIndirectObject(pDict); std::unique_ptr<CPDF_Font> pFont = CPDF_Font::Create(m_pPDFDoc, pDict); if (!pFont) return nullptr; |