diff options
author | dsinclair <dsinclair@chromium.org> | 2016-10-05 15:46:15 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-05 15:46:15 -0700 |
commit | 2116105b7d0545eb353264d4b42420cf51af5195 (patch) | |
tree | 959cb01c9d4049a9354657a7ea772b1c2860ab92 /fpdfsdk/fpdfxfa/cpdfxfa_document.cpp | |
parent | e883afcab15b17769bda0a1aac0f540568df3368 (diff) | |
download | pdfium-2116105b7d0545eb353264d4b42420cf51af5195.tar.xz |
Remove ownership of CPDFSDK_Document from CPDFXFA_Document
This CL updates CPDFXFA_Document so it never owns the CPDFSDK_Document. The
CPDFSDK_Document is now always owned by the CPDFXFA_Environment. This also
cleans up the strange need to reverse the order of document and form destruction
when using XFA.
Review-Url: https://codereview.chromium.org/2397473006
Diffstat (limited to 'fpdfsdk/fpdfxfa/cpdfxfa_document.cpp')
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_document.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp index e49cfde8c4..121d060453 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_document.cpp @@ -33,6 +33,7 @@ CPDFXFA_Document::CPDFXFA_Document(std::unique_ptr<CPDF_Document> pPDFDoc, CPDFXFA_App* pProvider) : m_iDocType(DOCTYPE_PDF), m_pPDFDoc(std::move(pPDFDoc)), + m_pSDKDoc(nullptr), m_pXFADocView(nullptr), m_pApp(pProvider), m_nLoadStatus(FXFA_LOADSTATUS_PRELOAD), @@ -42,6 +43,11 @@ CPDFXFA_Document::CPDFXFA_Document(std::unique_ptr<CPDF_Document> pPDFDoc, CPDFXFA_Document::~CPDFXFA_Document() { m_nLoadStatus = FXFA_LOADSTATUS_CLOSING; + if (m_pSDKDoc) { + m_pSDKDoc->ClearAllFocusedAnnots(); + m_pSDKDoc = nullptr; + } + if (m_pXFADoc) { CXFA_FFApp* pApp = m_pApp->GetXFAApp(); if (pApp) { @@ -191,10 +197,6 @@ void CPDFXFA_Document::RemovePage(CPDFXFA_Page* page) { m_XFAPageList.SetAt(page->GetPageIndex(), nullptr); } -void CPDFXFA_Document::SetSDKDoc(std::unique_ptr<CPDFSDK_Document> pSDKDoc) { - m_pSDKDoc.reset(pSDKDoc.release()); -} - void CPDFXFA_Document::ClearChangeMark() { if (m_pSDKDoc) m_pSDKDoc->ClearChangeMark(); |