Chromium Code Reviews| Index: fpdfsdk/javascript/Document.cpp |
| diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp |
| index c1381f5865d0fe481479c5b3f45e44646d4fb53d..6aa1dba286584ed83fe50ff9636ae8d5445cac58 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 maybe in the process of tearing down the document |
|
Lei Zhang
2016/09/06 20:45:45
s/maybe/may be/
dsinclair
2016/09/06 20:47:44
Done.
|
| + // 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(); |