| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "fpdfsdk/include/fsdk_mgr.h" | 7 #include "fpdfsdk/include/fsdk_mgr.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 | 346 |
| 347 void CPDFSDK_Document::RemovePageView(UnderlyingPageType* pUnderlyingPage) { | 347 void CPDFSDK_Document::RemovePageView(UnderlyingPageType* pUnderlyingPage) { |
| 348 auto it = m_pageMap.find(pUnderlyingPage); | 348 auto it = m_pageMap.find(pUnderlyingPage); |
| 349 if (it == m_pageMap.end()) | 349 if (it == m_pageMap.end()) |
| 350 return; | 350 return; |
| 351 | 351 |
| 352 CPDFSDK_PageView* pPageView = it->second; | 352 CPDFSDK_PageView* pPageView = it->second; |
| 353 if (pPageView->IsLocked()) | 353 if (pPageView->IsLocked()) |
| 354 return; | 354 return; |
| 355 | 355 |
| 356 // Remove the page from the map to make sure we don't accidentally attempt | |
| 357 // to use the |pPageView| while we're cleaning it up. | |
| 358 m_pageMap.erase(it); | |
| 359 | |
| 360 pPageView->KillFocusAnnotIfNeeded(); | 356 pPageView->KillFocusAnnotIfNeeded(); |
| 361 delete pPageView; | 357 delete pPageView; |
| 358 m_pageMap.erase(it); |
| 362 } | 359 } |
| 363 | 360 |
| 364 UnderlyingPageType* CPDFSDK_Document::GetPage(int nIndex) { | 361 UnderlyingPageType* CPDFSDK_Document::GetPage(int nIndex) { |
| 365 return UnderlyingFromFPDFPage(m_pEnv->FFI_GetPage(m_pDoc, nIndex)); | 362 return UnderlyingFromFPDFPage(m_pEnv->FFI_GetPage(m_pDoc, nIndex)); |
| 366 } | 363 } |
| 367 | 364 |
| 368 CPDFSDK_InterForm* CPDFSDK_Document::GetInterForm() { | 365 CPDFSDK_InterForm* CPDFSDK_Document::GetInterForm() { |
| 369 if (!m_pInterForm) | 366 if (!m_pInterForm) |
| 370 m_pInterForm.reset(new CPDFSDK_InterForm(this)); | 367 m_pInterForm.reset(new CPDFSDK_InterForm(this)); |
| 371 return m_pInterForm.get(); | 368 return m_pInterForm.get(); |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { | 1043 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { |
| 1047 #ifdef PDF_ENABLE_XFA | 1044 #ifdef PDF_ENABLE_XFA |
| 1048 CPDF_Page* pPage = m_page->GetPDFPage(); | 1045 CPDF_Page* pPage = m_page->GetPDFPage(); |
| 1049 #else // PDF_ENABLE_XFA | 1046 #else // PDF_ENABLE_XFA |
| 1050 CPDF_Page* pPage = m_page; | 1047 CPDF_Page* pPage = m_page; |
| 1051 #endif // PDF_ENABLE_XFA | 1048 #endif // PDF_ENABLE_XFA |
| 1052 CPDF_Dictionary* pDict = pPage->m_pFormDict; | 1049 CPDF_Dictionary* pDict = pPage->m_pFormDict; |
| 1053 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); | 1050 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); |
| 1054 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; | 1051 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; |
| 1055 } | 1052 } |
| OLD | NEW |