summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_document.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-10-05 15:46:15 -0700
committerCommit bot <commit-bot@chromium.org>2016-10-05 15:46:15 -0700
commit2116105b7d0545eb353264d4b42420cf51af5195 (patch)
tree959cb01c9d4049a9354657a7ea772b1c2860ab92 /fpdfsdk/cpdfsdk_document.cpp
parente883afcab15b17769bda0a1aac0f540568df3368 (diff)
downloadpdfium-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/cpdfsdk_document.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_document.cpp11
1 files changed, 7 insertions, 4 deletions
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(