summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_formfillenvironment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/cpdfsdk_formfillenvironment.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_formfillenvironment.cpp30
1 files changed, 16 insertions, 14 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);