summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfsave.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-05-18 12:10:49 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-18 12:10:49 -0700
commite7b2853a4143137803609fe96330d7924c1731ed (patch)
treeabc54132c4a402b11e6e3741fe620002b1a7ae9c /fpdfsdk/fpdfsave.cpp
parent501e8cdc9143d4b1bebd22e7bfdcae4368e459ee (diff)
downloadpdfium-e7b2853a4143137803609fe96330d7924c1731ed.tar.xz
Remove Release() from CXFA_WidgetAccIterator
Review-Url: https://codereview.chromium.org/1990793004
Diffstat (limited to 'fpdfsdk/fpdfsave.cpp')
-rw-r--r--fpdfsdk/fpdfsave.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp
index d48bfbb3b1..84de668dde 100644
--- a/fpdfsdk/fpdfsave.cpp
+++ b/fpdfsdk/fpdfsave.cpp
@@ -232,17 +232,13 @@ bool SendPostSaveToXFADoc(CPDFXFA_Document* pDocument) {
return false;
CXFA_FFWidgetHandler* pWidgetHander = pXFADocView->GetWidgetHandler();
- CXFA_WidgetAcc* pWidgetAcc = NULL;
- CXFA_WidgetAccIterator* pWidgetAccIterator =
- pXFADocView->CreateWidgetAccIterator();
- pWidgetAcc = pWidgetAccIterator->MoveToNext();
- while (pWidgetAcc) {
+ std::unique_ptr<CXFA_WidgetAccIterator> pWidgetAccIterator(
+ pXFADocView->CreateWidgetAccIterator());
+ while (CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext()) {
CXFA_EventParam preParam;
preParam.m_eType = XFA_EVENT_PostSave;
pWidgetHander->ProcessEvent(pWidgetAcc, &preParam);
- pWidgetAcc = pWidgetAccIterator->MoveToNext();
}
- pWidgetAccIterator->Release();
pXFADocView->UpdateDocView();
pDocument->_ClearChangeMark();
return true;
@@ -259,17 +255,13 @@ bool SendPreSaveToXFADoc(CPDFXFA_Document* pDocument,
return true;
CXFA_FFWidgetHandler* pWidgetHander = pXFADocView->GetWidgetHandler();
- CXFA_WidgetAcc* pWidgetAcc = NULL;
- CXFA_WidgetAccIterator* pWidgetAccIterator =
- pXFADocView->CreateWidgetAccIterator();
- pWidgetAcc = pWidgetAccIterator->MoveToNext();
- while (pWidgetAcc) {
+ std::unique_ptr<CXFA_WidgetAccIterator> pWidgetAccIterator(
+ pXFADocView->CreateWidgetAccIterator());
+ while (CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext()) {
CXFA_EventParam preParam;
preParam.m_eType = XFA_EVENT_PreSave;
pWidgetHander->ProcessEvent(pWidgetAcc, &preParam);
- pWidgetAcc = pWidgetAccIterator->MoveToNext();
}
- pWidgetAccIterator->Release();
pXFADocView->UpdateDocView();
return SaveXFADocumentData(pDocument, fileList);
}