summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2016-10-24 13:42:16 -0700
committerLei Zhang <thestig@chromium.org>2016-10-24 13:42:16 -0700
commitd586fe81bc2ec6785fa6d34df73fc564d48a2866 (patch)
tree53ae84eebac8ba2462e038ce4f4eaf035903ab42
parented6485f1aa4ce9de8b5cab86cc844df4f4bd0b52 (diff)
downloadpdfium-d586fe81bc2ec6785fa6d34df73fc564d48a2866.tar.xz
M55: Fixup formfiller cleanup
The CFFL_InteractiveFormFiller must be cleaned up before the environment because the destruction of the formfiller will trigger the destruction of the formfiller widgets. Some of those widgets may require stopping timers, which requires accessing the environment. BUG=chromium:654272, chromium:653459 TBR=tsepez@chromium.org Review-Url: https://codereview.chromium.org/2408163003 (cherry picked from commit 709f5a9301e91365ab87610993c497e386504ead) Review URL: https://codereview.chromium.org/2445873002 .
-rw-r--r--fpdfsdk/cpdfsdk_formfillenvironment.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index 5b05d08128..7b41ea148c 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -39,6 +39,16 @@ CPDFSDK_FormFillEnvironment::CPDFSDK_FormFillEnvironment(
m_pSysHandler(new CFX_SystemHandler(this)) {}
CPDFSDK_FormFillEnvironment::~CPDFSDK_FormFillEnvironment() {
+ // |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_pAnnotHandlerMgr.reset();
+
+ // Must destroy the |m_pFormFiller| before the environment (|this|)
+ // because any created form widgets hold a pointer to the environment.
+ // Those widgets may call things like KillTimer() as they are shutdown.
+ m_pFormFiller.reset();
+
#ifdef PDF_ENABLE_XFA
CPDFXFA_App* pProvider = CPDFXFA_App::GetInstance();
if (pProvider->m_pEnvList.GetSize() == 0)