From 3ba098595ae56b64eacc0c25ab76b89a4d78d920 Mon Sep 17 00:00:00 2001 From: tsepez Date: Fri, 14 Oct 2016 16:59:10 -0700 Subject: 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 --- core/fpdfapi/parser/cpdf_data_avail.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'core/fpdfapi/parser/cpdf_data_avail.cpp') diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp index 980c94d325..9629c204bb 100644 --- a/core/fpdfapi/parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/parser/cpdf_data_avail.cpp @@ -1771,8 +1771,9 @@ CPDF_Dictionary* CPDF_DataAvail::GetPage(int index) { if (!pPageDict) return nullptr; - if (!m_pDocument->ReplaceIndirectObjectIfHigherGeneration(dwObjNum, - pPageDict)) { + // TODO(tsepez): check |pPageDict| ownership. + if (!m_pDocument->ReplaceIndirectObjectIfHigherGeneration( + dwObjNum, UniqueObject(pPageDict))) { return nullptr; } return pPageDict->GetDict(); -- cgit v1.2.3