summaryrefslogtreecommitdiff
path: root/core/fpdfdoc
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-10-04 18:12:16 -0700
committerCommit bot <commit-bot@chromium.org>2016-10-04 18:12:17 -0700
commit98c6c15abfec45648d85c73e746f0cb109a8d35b (patch)
tree85fe31ac718cd4aa7600b2ea2881d5ac82b9f02a /core/fpdfdoc
parent4d29e78fc80285d222f2bad916354e3db970d0cc (diff)
downloadpdfium-98c6c15abfec45648d85c73e746f0cb109a8d35b.tar.xz
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
Diffstat (limited to 'core/fpdfdoc')
-rw-r--r--core/fpdfdoc/cpdf_annotlist.cpp5
1 files changed, 1 insertions, 4 deletions
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);
}