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

Unified Diff: fpdfsdk/cpdfsdk_document.cpp

Issue 2384243002: Guard against double deletion of page views. (Closed)
Patch Set: Created 4 years, 2 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 | fpdfsdk/cpdfsdk_pageview.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/cpdfsdk_document.cpp
diff --git a/fpdfsdk/cpdfsdk_document.cpp b/fpdfsdk/cpdfsdk_document.cpp
index ad4516d53c1b2606bcce360720b5d6d67c5ca77d..66851c0ebb9493df4b38b354225ce82761620687 100644
--- a/fpdfsdk/cpdfsdk_document.cpp
+++ b/fpdfsdk/cpdfsdk_document.cpp
@@ -135,9 +135,13 @@ void CPDFSDK_Document::RemovePageView(UnderlyingPageType* pUnderlyingPage) {
return;
CPDFSDK_PageView* pPageView = it->second;
- if (pPageView->IsLocked())
+ if (pPageView->IsLocked() || pPageView->IsBeingDestroyed())
return;
+ // Mark the page view so we do not come into |RemovePageView| a second
+ // time while we're in the process of removing.
+ pPageView->SetBeingDestroyed();
Tom Sepez 2016/10/03 18:37:57 Can we this to the dtor? Then the dtor checks for
dsinclair 2016/10/03 18:47:08 No, because we have to guard the map erasing and t
+
// 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
« no previous file with comments | « no previous file | fpdfsdk/cpdfsdk_pageview.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698