diff options
author | Jun Fang <jun_fang@foxitsoftware.com> | 2015-12-11 22:21:29 -0800 |
---|---|---|
committer | Jun Fang <jun_fang@foxitsoftware.com> | 2015-12-11 22:21:29 -0800 |
commit | 790842ab3c35c09d0692dc07979a7e91ec183014 (patch) | |
tree | 4c4e47fa64e928ffbe61b7d7650f2a6e4be06163 | |
parent | e0bb17b98ce909edee8b14c2b2036b71b3f75593 (diff) | |
download | pdfium-790842ab3c35c09d0692dc07979a7e91ec183014.tar.xz |
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 .
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_layout_appadapter.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
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<CXFA_ContainerLayoutItem*>(pLayoutItem),
+ XFA_PAGEEVENT_PageRemoved);
+ }
delete pLayoutItem;
}
|