summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fsdk_mgr.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp
index eb3f51e97c..694e3154ce 100644
--- a/fpdfsdk/fsdk_mgr.cpp
+++ b/fpdfsdk/fsdk_mgr.cpp
@@ -361,11 +361,17 @@ void CPDFSDK_Document::RemovePageView(UnderlyingPageType* pUnderlyingPage) {
if (pPageView->IsLocked())
return;
+ // This must happen before we remove |pPageView| from the map because
+ // |KillFocusAnnotIfNeeded| can call into the |GetPage| method which will
+ // look for this page view in the map, if it doesn't find it a new one will
+ // be created. We then have two page views pointing to the same page and
+ // bad things happen.
+ pPageView->KillFocusAnnotIfNeeded();
+
// 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;
}