summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-07-26 12:19:43 -0700
committerCommit bot <commit-bot@chromium.org>2016-07-26 12:19:43 -0700
commitf2cee9894b9f7cf2e50060965ad1eedd90ab55b6 (patch)
treea6f1df9bb80ceeccc778c5ed186d9e4868b99506
parent49dce65dc78bcd5a0c78a8bbdf2809cf20212220 (diff)
downloadpdfium-f2cee9894b9f7cf2e50060965ad1eedd90ab55b6.tar.xz
Revert of Remove pageview from map immediately (patchset #1 id:1 of https://codereview.chromium.org/2179283005/ )
Reason for revert: Looks like this broke linux_asan embedder tests. https://build.chromium.org/p/client.pdfium/builders/linux_asan/builds/1152/steps/embeddertests/logs/stdio Original issue's description: > Remove pageview from map immediately > > There seems to be an ownership issue in the page annotation code where removing > the annotations can result in removing the parent page view. This is fine except > that removing the parent page view removes the annotations and you can end up > with a use-after-free. > > This CL removes the page view from the documents page map immediately and then > proceeds with the cleanup. Then, if we try to remove that page again it won't > be found and we won't double free. > > BUG=chromium:630654 > > Committed: https://pdfium.googlesource.com/pdfium/+/49dce65dc78bcd5a0c78a8bbdf2809cf20212220 TBR=thestig@chromium.org,weili@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=chromium:630654 Review-Url: https://codereview.chromium.org/2188523002
-rw-r--r--fpdfsdk/fsdk_mgr.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp
index d1e55074f9..68143d2bdd 100644
--- a/fpdfsdk/fsdk_mgr.cpp
+++ b/fpdfsdk/fsdk_mgr.cpp
@@ -353,12 +353,9 @@ 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) {