From e7b2853a4143137803609fe96330d7924c1731ed Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 18 May 2016 12:10:49 -0700 Subject: Remove Release() from CXFA_WidgetAccIterator Review-Url: https://codereview.chromium.org/1990793004 --- fpdfsdk/fpdfsave.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'fpdfsdk/fpdfsave.cpp') 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 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 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); } -- cgit v1.2.3