From 649e059f5fe93c0de53aaa48a74068703df46301 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 30 Jul 2018 20:27:21 +0000 Subject: Return unique_ptr from CXFA_FFNotify::OnCreate{Container,Content}LayoutItem() ... and then immediately release it, but it is a step in the right direction. Change-Id: Ib52972c6789d8f98a576d1c69f8019541c96ac51 Reviewed-on: https://pdfium-review.googlesource.com/39152 Commit-Queue: Tom Sepez Reviewed-by: Lei Zhang --- xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp | 7 ++++--- xfa/fxfa/parser/cxfa_layoutpagemgr.cpp | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'xfa/fxfa/parser') diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp index 60dd8a37a5..e09b17d730 100644 --- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp @@ -652,9 +652,10 @@ CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( m_pOldLayoutItem = m_pOldLayoutItem->m_pNext; return pLayoutItem; } - pLayoutItem = - pFormNode->GetDocument()->GetNotify()->OnCreateContentLayoutItem( - pFormNode); + pLayoutItem = pFormNode->GetDocument() + ->GetNotify() + ->OnCreateContentLayoutItem(pFormNode) + .release(); CXFA_ContentLayoutItem* pPrevLayoutItem = ToContentLayoutItem(pFormNode->JSObject()->GetLayoutItem()); if (pPrevLayoutItem) { diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp index b6c95c1d56..411ad24e45 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp @@ -582,7 +582,8 @@ void CXFA_LayoutPageMgr::AddPageAreaLayoutItem(CXFA_ContainerRecord* pNewRecord, pNewPageAreaLayoutItem = pContainerItem; } else { CXFA_FFNotify* pNotify = pNewPageArea->GetDocument()->GetNotify(); - auto* pContainerItem = pNotify->OnCreateContainerLayoutItem(pNewPageArea); + auto* pContainerItem = + pNotify->OnCreateContainerLayoutItem(pNewPageArea).release(); m_PageArray.push_back(pContainerItem); m_nAvailPages++; pNotify->OnPageEvent(pContainerItem, XFA_PAGEVIEWEVENT_PostRemoved); -- cgit v1.2.3