summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
authorunknown <jinming_wang@foxitsoftware.com>2014-10-29 19:37:24 +0800
committerBo Xu <bo_xu@foxitsoftware.com>2014-11-03 11:10:15 -0800
commit636ad3b7cc8bf9e7afa1084a0b4e5ec2a05196c7 (patch)
treeadf52d21e1a9f3ff8c93efc0a484f975440c6a91 /fpdfsdk/src
parentffff9f210464c9f0351a8e434db18b4ec30d2b1b (diff)
downloadpdfium-636ad3b7cc8bf9e7afa1084a0b4e5ec2a05196c7.tar.xz
Lock page in LoadFXAnnot to prevent unintended page closing
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/fsdk_mgr.cpp19
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)