diff options
author | tsepez <tsepez@chromium.org> | 2016-05-16 13:21:03 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-16 13:21:03 -0700 |
commit | cc4d6d85b58a7a1d9d7b798c63d3343f3dac06a9 (patch) | |
tree | fda580a573f97d15c9484c57ebf8fae66342ab83 /fpdfsdk | |
parent | e699c66433049396e438d983a1837b9d4a4cf766 (diff) | |
download | pdfium-cc4d6d85b58a7a1d9d7b798c63d3343f3dac06a9.tar.xz |
Remove { delete this; } anti-pattern from IXFA_WidgetIterator
Review-Url: https://codereview.chromium.org/1976123003
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/fpdfformfill.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/fsdk_annothandler.cpp | 12 | ||||
-rw-r--r-- | fpdfsdk/fsdk_mgr.cpp | 11 |
3 files changed, 12 insertions, 15 deletions
diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp index 153c1057a5..94a8bf12a5 100644 --- a/fpdfsdk/fpdfformfill.cpp +++ b/fpdfsdk/fpdfformfill.cpp @@ -91,8 +91,8 @@ DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, if (!pWidgetHandler) return -1; - std::unique_ptr<IXFA_WidgetIterator, ReleaseDeleter<IXFA_WidgetIterator>> - pWidgetIterator(pPageView->CreateWidgetIterator( + std::unique_ptr<IXFA_WidgetIterator> pWidgetIterator( + pPageView->CreateWidgetIterator( XFA_TRAVERSEWAY_Form, XFA_WIDGETFILTER_Viewable | XFA_WIDGETFILTER_AllType)); if (!pWidgetIterator) diff --git a/fpdfsdk/fsdk_annothandler.cpp b/fpdfsdk/fsdk_annothandler.cpp index 73701cfb4c..db2d20b2bf 100644 --- a/fpdfsdk/fsdk_annothandler.cpp +++ b/fpdfsdk/fsdk_annothandler.cpp @@ -376,22 +376,20 @@ CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot, return pNext; } // for xfa annots - IXFA_WidgetIterator* pWidgetIterator = + std::unique_ptr<IXFA_WidgetIterator> pWidgetIterator( pPage->GetXFAPageView()->CreateWidgetIterator( XFA_TRAVERSEWAY_Tranvalse, XFA_WIDGETFILTER_Visible | XFA_WIDGETFILTER_Viewable | - XFA_WIDGETFILTER_Field); - if (pWidgetIterator == NULL) - return NULL; + XFA_WIDGETFILTER_Field)); + if (!pWidgetIterator) + return nullptr; if (pWidgetIterator->GetCurrentWidget() != pSDKAnnot->GetXFAWidget()) pWidgetIterator->SetCurrentWidget(pSDKAnnot->GetXFAWidget()); - CXFA_FFWidget* hNextFocus = NULL; - hNextFocus = + CXFA_FFWidget* hNextFocus = bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); if (!hNextFocus && pSDKAnnot) hNextFocus = pWidgetIterator->MoveToFirst(); - pWidgetIterator->Release(); return pPageView->GetAnnotByXFAWidget(hNextFocus); #else // PDF_ENABLE_XFA CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "Widget", ""); diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp index 4ab4850c4d..2d641783f9 100644 --- a/fpdfsdk/fsdk_mgr.cpp +++ b/fpdfsdk/fsdk_mgr.cpp @@ -905,10 +905,11 @@ void CPDFSDK_PageView::LoadFXAnnots() { m_page->AddRef(); if (m_pSDKDoc->GetXFADocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) { CXFA_FFPageView* pageView = m_page->GetXFAPageView(); - IXFA_WidgetIterator* pWidgetHander = pageView->CreateWidgetIterator( - XFA_TRAVERSEWAY_Form, XFA_WIDGETFILTER_Visible | - XFA_WIDGETFILTER_Viewable | - XFA_WIDGETFILTER_AllType); + std::unique_ptr<IXFA_WidgetIterator> pWidgetHander( + pageView->CreateWidgetIterator(XFA_TRAVERSEWAY_Form, + XFA_WIDGETFILTER_Visible | + XFA_WIDGETFILTER_Viewable | + XFA_WIDGETFILTER_AllType)); if (!pWidgetHander) { m_page->Release(); SetLock(FALSE); @@ -919,11 +920,9 @@ void CPDFSDK_PageView::LoadFXAnnots() { CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pXFAAnnot, this); if (!pAnnot) continue; - m_fxAnnotArray.push_back(pAnnot); pAnnotHandlerMgr->Annot_OnLoad(pAnnot); } - pWidgetHander->Release(); } else { CPDF_Page* pPage = m_page->GetPDFPage(); ASSERT(pPage); |