Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1590)

Unified Diff: fpdfsdk/fsdk_mgr.cpp

Issue 2179163004: Reland of Remove pageview from map immediately (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: FX_BOOL to bool Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/fsdk_baseform.cpp ('k') | fpdfsdk/include/fsdk_mgr.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fsdk_mgr.cpp
diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp
index 68143d2bdde1df3a7ee808ee4d3fed6f0af0d3a7..8587de1e80f5de7938bd318bcd00a2d664195c7c 100644
--- a/fpdfsdk/fsdk_mgr.cpp
+++ b/fpdfsdk/fsdk_mgr.cpp
@@ -263,7 +263,7 @@ CPDFSDK_Document::~CPDFSDK_Document() {
CPDFSDK_PageView* CPDFSDK_Document::GetPageView(
UnderlyingPageType* pUnderlyingPage,
- FX_BOOL ReNew) {
+ bool ReNew) {
auto it = m_pageMap.find(pUnderlyingPage);
if (it != m_pageMap.end())
return it->second;
@@ -281,7 +281,7 @@ CPDFSDK_PageView* CPDFSDK_Document::GetPageView(
CPDFSDK_PageView* CPDFSDK_Document::GetCurrentView() {
UnderlyingPageType* pPage =
UnderlyingFromFPDFPage(m_pEnv->FFI_GetCurrentPage(m_pDoc));
- return pPage ? GetPageView(pPage, TRUE) : nullptr;
+ return pPage ? GetPageView(pPage, true) : nullptr;
}
CPDFSDK_PageView* CPDFSDK_Document::GetPageView(int nIndex) {
@@ -353,9 +353,12 @@ void CPDFSDK_Document::RemovePageView(UnderlyingPageType* pUnderlyingPage) {
if (pPageView->IsLocked())
return;
+ // Remove the page from the map to make sure we don't accidentally attempt
+ // to use the |pPageView| while we're cleaning it up.
+ m_pageMap.erase(it);
+
pPageView->KillFocusAnnotIfNeeded();
delete pPageView;
- m_pageMap.erase(it);
}
UnderlyingPageType* CPDFSDK_Document::GetPage(int nIndex) {
« no previous file with comments | « fpdfsdk/fsdk_baseform.cpp ('k') | fpdfsdk/include/fsdk_mgr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698