From 98c6c15abfec45648d85c73e746f0cb109a8d35b Mon Sep 17 00:00:00 2001 From: tsepez Date: Tue, 4 Oct 2016 18:12:16 -0700 Subject: Fix ownership when making a private annot dictionary into a shared one. There's no way to take ownership back from the CPDF_Array without deleting the object, so add a new primitive to make elements become indirect rather than manipulating them outside the class. This should solve the ASSERT(objnum == 0) issue that blocked the previous roll. Review-Url: https://codereview.chromium.org/2391883003 --- core/fpdfdoc/cpdf_annotlist.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'core/fpdfdoc/cpdf_annotlist.cpp') diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp index 0d9c613e91..940cf324f4 100644 --- a/core/fpdfdoc/cpdf_annotlist.cpp +++ b/core/fpdfdoc/cpdf_annotlist.cpp @@ -73,10 +73,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) uint32_t dwObjNum = pDict->GetObjNum(); if (dwObjNum == 0) { - dwObjNum = m_pDocument->AddIndirectObject(pDict); - CPDF_Reference* pAction = new CPDF_Reference(m_pDocument, dwObjNum); - pAnnots->InsertAt(i, pAction); - pAnnots->RemoveAt(i + 1); + pAnnots->ConvertToIndirectObjectAt(i, m_pDocument); pDict = pAnnots->GetDictAt(i); } -- cgit v1.2.3