Index: fpdfsdk/fsdk_mgr.cpp |
diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp |
index 68143d2bdde1df3a7ee808ee4d3fed6f0af0d3a7..d1e55074f9d07344f650b4dd225e96e3b1c324c2 100644 |
--- a/fpdfsdk/fsdk_mgr.cpp |
+++ b/fpdfsdk/fsdk_mgr.cpp |
@@ -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) { |