From 790842ab3c35c09d0692dc07979a7e91ec183014 Mon Sep 17 00:00:00 2001 From: Jun Fang Date: Fri, 11 Dec 2015 22:21:29 -0800 Subject: Fix a crasher in CXFA_FFDocView::SetFocus() When some layout items are released, applications should be notified. It usually happens when there are layout changes. BUG=pdfium:303 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1502133002 . --- xfa/src/fxfa/src/parser/xfa_layout_appadapter.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'xfa/src/fxfa') diff --git a/xfa/src/fxfa/src/parser/xfa_layout_appadapter.cpp b/xfa/src/fxfa/src/parser/xfa_layout_appadapter.cpp index ae843cfdb4..e98795b5c9 100644 --- a/xfa/src/fxfa/src/parser/xfa_layout_appadapter.cpp +++ b/xfa/src/fxfa/src/parser/xfa_layout_appadapter.cpp @@ -41,12 +41,18 @@ FX_DWORD XFA_GetRelevant(CXFA_Node* pFormItem, FX_DWORD dwParentRelvant) { return dwRelevant; } void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem) { - CXFA_LayoutItem* pNext, * pNode = pLayoutItem->m_pFirstChild; + CXFA_LayoutItem* pNode = pLayoutItem->m_pFirstChild; while (pNode) { - pNext = pNode->m_pNextSibling; - pNode->m_pParent = NULL; + CXFA_LayoutItem* pNext = pNode->m_pNextSibling; + pNode->m_pParent = nullptr; XFA_ReleaseLayoutItem(pNode); pNode = pNext; } + IXFA_Notify* pNotify = + pLayoutItem->m_pFormNode->GetDocument()->GetParser()->GetNotify(); + if (pLayoutItem->m_pFormNode->GetClassID() == XFA_ELEMENT_PageArea) { + pNotify->OnPageEvent(static_cast(pLayoutItem), + XFA_PAGEEVENT_PageRemoved); + } delete pLayoutItem; } -- cgit v1.2.3