summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/cpdfsdk_formfillenvironment.cpp30
-rw-r--r--fpdfsdk/cpdfsdk_formfillenvironment.h4
2 files changed, 18 insertions, 16 deletions
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index 9852bdc9b9..8ab3b46a91 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -41,12 +41,14 @@ CPDFSDK_FormFillEnvironment::CPDFSDK_FormFillEnvironment(
CPDFSDK_FormFillEnvironment::~CPDFSDK_FormFillEnvironment() {
m_bBeingDestroyed = true;
-
ClearAllFocusedAnnots();
- // |m_pAnnotHandlerMgr| will try to access |m_pFormFiller|
- // when it cleans up. So, we must make sure it is cleaned up before
- // |m_pFormFiller|.
+ // |m_PageMap| will try to access |m_pInterForm| when it cleans itself up.
+ // Make sure it is deleted before |m_pInterForm|.
+ m_PageMap.clear();
+
+ // |m_pAnnotHandlerMgr| will try to access |m_pFormFiller| when it cleans
+ // itself up. Make sure it is deleted before |m_pFormFiller|.
m_pAnnotHandlerMgr.reset();
// Must destroy the |m_pFormFiller| before the environment (|this|)
@@ -563,7 +565,7 @@ void CPDFSDK_FormFillEnvironment::PageEvent(int iPageCount,
#endif // PDF_ENABLE_XFA
void CPDFSDK_FormFillEnvironment::ClearAllFocusedAnnots() {
- for (auto& it : m_pageMap) {
+ for (auto& it : m_PageMap) {
if (it.second->IsValidSDKAnnot(GetFocusAnnot()))
KillFocusAnnot(0);
}
@@ -572,15 +574,15 @@ void CPDFSDK_FormFillEnvironment::ClearAllFocusedAnnots() {
CPDFSDK_PageView* CPDFSDK_FormFillEnvironment::GetPageView(
UnderlyingPageType* pUnderlyingPage,
bool renew) {
- auto it = m_pageMap.find(pUnderlyingPage);
- if (it != m_pageMap.end())
+ auto it = m_PageMap.find(pUnderlyingPage);
+ if (it != m_PageMap.end())
return it->second.get();
if (!renew)
return nullptr;
CPDFSDK_PageView* pPageView = new CPDFSDK_PageView(this, pUnderlyingPage);
- m_pageMap[pUnderlyingPage].reset(pPageView);
+ m_PageMap[pUnderlyingPage].reset(pPageView);
// Delay to load all the annotations, to avoid endless loop.
pPageView->LoadFXAnnots();
return pPageView;
@@ -598,8 +600,8 @@ CPDFSDK_PageView* CPDFSDK_FormFillEnvironment::GetPageView(int nIndex) {
if (!pTempPage)
return nullptr;
- auto it = m_pageMap.find(pTempPage);
- return it != m_pageMap.end() ? it->second.get() : nullptr;
+ auto it = m_PageMap.find(pTempPage);
+ return it != m_PageMap.end() ? it->second.get() : nullptr;
}
void CPDFSDK_FormFillEnvironment::ProcJavascriptFun() {
@@ -647,8 +649,8 @@ bool CPDFSDK_FormFillEnvironment::ProcOpenAction() {
void CPDFSDK_FormFillEnvironment::RemovePageView(
UnderlyingPageType* pUnderlyingPage) {
- auto it = m_pageMap.find(pUnderlyingPage);
- if (it == m_pageMap.end())
+ auto it = m_PageMap.find(pUnderlyingPage);
+ if (it == m_PageMap.end())
return;
CPDFSDK_PageView* pPageView = it->second.get();
@@ -669,7 +671,7 @@ void CPDFSDK_FormFillEnvironment::RemovePageView(
// 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);
+ m_PageMap.erase(it);
}
UnderlyingPageType* CPDFSDK_FormFillEnvironment::GetPage(int nIndex) {
@@ -684,7 +686,7 @@ CPDFSDK_InterForm* CPDFSDK_FormFillEnvironment::GetInterForm() {
void CPDFSDK_FormFillEnvironment::UpdateAllViews(CPDFSDK_PageView* pSender,
CPDFSDK_Annot* pAnnot) {
- for (const auto& it : m_pageMap) {
+ for (const auto& it : m_PageMap) {
CPDFSDK_PageView* pPageView = it.second.get();
if (pPageView != pSender)
pPageView->UpdateView(pAnnot);
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h
index 2438019707..b7afbbc489 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.h
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.h
@@ -112,7 +112,7 @@ class CPDFSDK_FormFillEnvironment
CPDFXFA_Context* GetXFAContext() const { return m_pUnderlyingDoc; }
void ResetXFADocument() { m_pUnderlyingDoc = nullptr; }
- int GetPageViewCount() const { return m_pageMap.size(); }
+ int GetPageViewCount() const { return m_PageMap.size(); }
void DisplayCaret(FPDF_PAGE page,
FPDF_BOOL bVisible,
@@ -213,7 +213,7 @@ class CPDFSDK_FormFillEnvironment
std::unique_ptr<CPDFSDK_ActionHandler> m_pActionHandler;
std::unique_ptr<IJS_Runtime> m_pJSRuntime;
FPDF_FORMFILLINFO* const m_pInfo;
- std::map<UnderlyingPageType*, std::unique_ptr<CPDFSDK_PageView>> m_pageMap;
+ std::map<UnderlyingPageType*, std::unique_ptr<CPDFSDK_PageView>> m_PageMap;
std::unique_ptr<CPDFSDK_InterForm> m_pInterForm;
CPDFSDK_Annot::ObservedPtr m_pFocusAnnot;
UnderlyingDocumentType* m_pUnderlyingDoc;