diff options
author | unknown <jinming_wang@foxitsoftware.com> | 2014-10-29 19:37:24 +0800 |
---|---|---|
committer | Bo Xu <bo_xu@foxitsoftware.com> | 2014-11-03 11:10:15 -0800 |
commit | 636ad3b7cc8bf9e7afa1084a0b4e5ec2a05196c7 (patch) | |
tree | adf52d21e1a9f3ff8c93efc0a484f975440c6a91 /fpdfsdk/src/fsdk_mgr.cpp | |
parent | ffff9f210464c9f0351a8e434db18b4ec30d2b1b (diff) | |
download | pdfium-636ad3b7cc8bf9e7afa1084a0b4e5ec2a05196c7.tar.xz |
Lock page in LoadFXAnnot to prevent unintended page closing
Diffstat (limited to 'fpdfsdk/src/fsdk_mgr.cpp')
-rw-r--r-- | fpdfsdk/src/fsdk_mgr.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp index 2340ffa720..c4cee6f4d8 100644 --- a/fpdfsdk/src/fsdk_mgr.cpp +++ b/fpdfsdk/src/fsdk_mgr.cpp @@ -334,6 +334,14 @@ CPDFSDK_Document::CPDFSDK_Document(CPDFXFA_Document* pDoc,CPDFDoc_Environment* p CPDFSDK_Document::~CPDFSDK_Document() { + FX_POSITION pos = m_pageMap.GetStartPosition(); + while(pos) + { + CPDFXFA_Page* pPage = NULL; + CPDFSDK_PageView* pPageView = NULL; + m_pageMap.GetNextAssoc(pos, pPage, pPageView); + delete pPageView; + } m_pageMap.RemoveAll(); if(m_pInterForm) { @@ -455,7 +463,7 @@ CPDF_OCContext* CPDFSDK_Document::GetOCContext() void CPDFSDK_Document::ReMovePageView(CPDFXFA_Page* pPDFXFAPage) { CPDFSDK_PageView* pPageView = (CPDFSDK_PageView*)m_pageMap.GetValueAt(pPDFXFAPage); - if(pPageView) + if(pPageView && !pPageView->IsLocked()) { delete pPageView; m_pageMap.RemoveKey(pPDFXFAPage); @@ -630,6 +638,7 @@ CPDFSDK_PageView::CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc,CPDFXFA_Page* page) m_bOnWidget = FALSE; m_CaptureWidget = NULL; m_bValid = FALSE; + m_bLocked = FALSE; m_pAnnotList = NULL; } @@ -1114,6 +1123,8 @@ void CPDFSDK_PageView::LoadFXAnnots() CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); ASSERT(pAnnotHandlerMgr != NULL); + SetLock(TRUE); + m_page->AddRef(); if (m_pSDKDoc->GetDocument()->GetDocType() == DOCTYPE_DYNIMIC_XFA) { IXFA_PageView* pageView = NULL; @@ -1123,7 +1134,11 @@ void CPDFSDK_PageView::LoadFXAnnots() XFA_HWIDGET pXFAAnnot = NULL; IXFA_WidgetIterator* pWidgetHander = pageView->CreateWidgetIterator(XFA_TRAVERSEWAY_Form, XFA_WIDGETFILTER_Visible|XFA_WIDGETFILTER_Viewable|XFA_WIDGETFILTER_AllType); if (!pWidgetHander) + { + m_page->Release(); + SetLock(FALSE); return; + } pXFAAnnot = pWidgetHander->MoveToNext(); while (pXFAAnnot) { @@ -1170,6 +1185,8 @@ void CPDFSDK_PageView::LoadFXAnnots() } } + m_page->Release(); + SetLock(FALSE); } void CPDFSDK_PageView::UpdateRects(CFX_RectArray& rects) |