From 461eeafe191068ac8c32f2717907fc6a22a667d2 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 27 Jul 2016 07:40:05 -0700 Subject: Reland of Remove pageview from map immediately This reverts commit f2cee9894b9f7cf2e50060965ad1eedd90ab55b6. This CL removes the default parameter from the CPDFSDK_Document::GetPageView |ReNew| flag and updates the code as needed. In CFFL_FormFillter::KillFocusForAnnot we flip the flag to |FALSE| as we don't want to re-create the page view if it is already removed. If we don't do this then the page view will be re-created in the map, the page associated to the page view, but then the page can be deleted out from under the pageview as it isn't owned by the page view. BUG=chromium:630654 Review-Url: https://codereview.chromium.org/2179163004 --- fpdfsdk/javascript/Document.cpp | 2 +- fpdfsdk/javascript/Field.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'fpdfsdk/javascript') diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp index caaeba884e..ace805f3b5 100644 --- a/fpdfsdk/javascript/Document.cpp +++ b/fpdfsdk/javascript/Document.cpp @@ -492,7 +492,7 @@ FX_BOOL Document::removeField(IJS_Context* cc, UnderlyingPageType* pPage = pWidget->GetUnderlyingPage(); ASSERT(pPage); - CPDFSDK_PageView* pPageView = m_pDocument->GetPageView(pPage); + CPDFSDK_PageView* pPageView = m_pDocument->GetPageView(pPage, true); pPageView->DeleteAnnot(pWidget); pPageView->UpdateRects(aRefresh); } diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp index ee910329d5..9b109f7b1b 100644 --- a/fpdfsdk/javascript/Field.cpp +++ b/fpdfsdk/javascript/Field.cpp @@ -3247,7 +3247,8 @@ FX_BOOL Field::setFocus(IJS_Context* cc, pEnv->FFI_GetCurrentPage(m_pDocument->GetUnderlyingDocument())); if (!pPage) return FALSE; - if (CPDFSDK_PageView* pCurPageView = m_pDocument->GetPageView(pPage)) { + if (CPDFSDK_PageView* pCurPageView = + m_pDocument->GetPageView(pPage, true)) { for (int32_t i = 0; i < nCount; i++) { if (CPDFSDK_Widget* pTempWidget = pInterForm->GetWidget(pFormField->GetControl(i))) { -- cgit v1.2.3