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

Unified Diff: fpdfsdk/javascript/Document.cpp

Issue 2312023004: Do not re-create the page view when accessing from Document::removeField. (Closed)
Patch Set: review feedback 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/javascript/Document.cpp
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp
index c1381f5865d0fe481479c5b3f45e44646d4fb53d..d8e36227e5b54eeed1fdad8286bc7209c8b10076 100644
--- a/fpdfsdk/javascript/Document.cpp
+++ b/fpdfsdk/javascript/Document.cpp
@@ -463,7 +463,7 @@ FX_BOOL Document::print(IJS_Context* cc,
// removes the specified field from the document.
// comment:
-// note: if the filed name is not retional, adobe is dumb for it.
+// note: if the filed name is not rational, adobe is dumb for it.
FX_BOOL Document::removeField(IJS_Context* cc,
const std::vector<CJS_Value>& params,
@@ -500,9 +500,14 @@ FX_BOOL Document::removeField(IJS_Context* cc,
UnderlyingPageType* pPage = pWidget->GetUnderlyingPage();
ASSERT(pPage);
- CPDFSDK_PageView* pPageView = m_pDocument->GetPageView(pPage, true);
- pPageView->DeleteAnnot(pWidget);
- pPageView->UpdateRects(aRefresh);
+ // If there is currently no pageview associated with the page being used
+ // do not create one. We may be in the process of tearing down the document
+ // and creating a new pageview at this point will cause bad things.
+ CPDFSDK_PageView* pPageView = m_pDocument->GetPageView(pPage, false);
+ if (pPageView) {
+ pPageView->DeleteAnnot(pWidget);
+ pPageView->UpdateRects(aRefresh);
+ }
}
m_pDocument->SetChangeMark();
« 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