summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-05-17 18:30:32 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-17 18:30:32 +0000
commit30f739c81db8d6fb4cb68347eae6b2a785cd6414 (patch)
tree126e030955f715459a8b0ace7457484c91d561c2 /fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
parent902a2288ffb3dc000e25445a3011a40d8ebb5f2a (diff)
downloadpdfium-30f739c81db8d6fb4cb68347eae6b2a785cd6414.tar.xz
Make CXFA_LayoutProcessor an UnownedPtr in CXFA_FFDocView
The LayoutProcessor is owned by the CXFA_Document. Make the ownership explicit with an UnownedPtr. Change-Id: I100af9e2e029e0a5db4ee365e11977016ffdcd70 Reviewed-on: https://pdfium-review.googlesource.com/32670 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfxfa/cpdfxfa_context.cpp')
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_context.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
index ed58d24b1f..84fcb37d16 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
@@ -73,8 +73,16 @@ void CPDFXFA_Context::SetFormFillEnv(
// The layout data can have pointers back into the script context. That
// context will be different if the form fill environment closes, so, force
// the layout data to clear.
- if (m_pXFADoc && m_pXFADoc->GetXFADoc())
+ if (m_pXFADoc && m_pXFADoc->GetXFADoc()) {
+ // The CPDF_XFADocView has a pointer to the CXFA_LayoutProcessor which is
+ // owned by the CXFA_Document. The Layout Processor will be freed with the
+ // ClearLayoutData() call. Make sure the doc view has already released the
+ // pointer.
+ if (m_pXFADocView)
+ m_pXFADocView->ResetLayoutProcessor();
+
m_pXFADoc->GetXFADoc()->ClearLayoutData();
+ }
m_pFormFillEnv.Reset(pFormFillEnv);
}