From 2116105b7d0545eb353264d4b42420cf51af5195 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 5 Oct 2016 15:46:15 -0700 Subject: 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 --- fpdfsdk/cpdfsdk_document.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'fpdfsdk/cpdfsdk_document.cpp') diff --git a/fpdfsdk/cpdfsdk_document.cpp b/fpdfsdk/cpdfsdk_document.cpp index 544c1e6e19..a0febafd48 100644 --- a/fpdfsdk/cpdfsdk_document.cpp +++ b/fpdfsdk/cpdfsdk_document.cpp @@ -39,14 +39,17 @@ CPDFSDK_Document::CPDFSDK_Document(UnderlyingDocumentType* pDoc, CPDFSDK_Document::~CPDFSDK_Document() { m_bBeingDestroyed = TRUE; + ClearAllFocusedAnnots(); + for (auto& it : m_pageMap) + delete it.second; + m_pageMap.clear(); +} + +void CPDFSDK_Document::ClearAllFocusedAnnots() { for (auto& it : m_pageMap) { if (it.second->IsValidSDKAnnot(GetFocusAnnot())) KillFocusAnnot(0); } - - for (auto& it : m_pageMap) - delete it.second; - m_pageMap.clear(); } CPDFSDK_PageView* CPDFSDK_Document::GetPageView( -- cgit v1.2.3