Index: fpdfsdk/cpdfsdk_document.cpp |
diff --git a/fpdfsdk/cpdfsdk_document.cpp b/fpdfsdk/cpdfsdk_document.cpp |
index 544c1e6e195b8c9dfea914292dede185875999a0..a0febafd484e38968077bc26454f19d494dd5a62 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( |