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

Unified Diff: fpdfsdk/fsdk_mgr.cpp

Issue 2338893002: [Merge to 54] Fix CPDFSDK_PageView cleanup. (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | no next file » | 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 9017e20b3277f0782ada51639867141ef31249ba..e142c0c229fe3f4188809b1aa258a4e65b6e07e4 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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698