From c30d5bf3efaef5c7254ae326466e6a35cff63365 Mon Sep 17 00:00:00 2001 From: Jun Fang Date: Tue, 2 Feb 2016 18:12:23 -0800 Subject: XFA: Fix a crashier in SetFocus() BUG=pdfium:374 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1640233004 . --- fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'fpdfsdk/src/fpdfxfa') diff --git a/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp index e1f14aa9d4..b8549fce74 100644 --- a/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp +++ b/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp @@ -477,17 +477,21 @@ void CPDFXFA_Document::PageViewEvent(IXFA_PageView* pPageView, return; } CPDFXFA_Page* pPage = nullptr; + CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); if (dwFlags == XFA_PAGEVIEWEVENT_PostAdded) { - pPage = GetPage(pPageView->GetPageViewIndex()); + int nPageIndex = pPageView->GetPageViewIndex(); + pPage = GetPage(nPageIndex); if (pPage) pPage->SetXFAPageView(pPageView); + pEnv->FFI_PageEvent(nPageIndex, dwFlags); return; } pPage = GetPage(pPageView); if (!pPage) return; - pPage->SetXFAPageView(nullptr); + pEnv->FFI_PageEvent(pPage->GetPageIndex(), dwFlags); m_pSDKDoc->GetPageView(pPage)->ClearFXAnnots(); + pPage->Release(); } void CPDFXFA_Document::WidgetEvent(IXFA_Widget* hWidget, -- cgit v1.2.3