Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1016)

Unified Diff: fpdfsdk/fsdk_mgr.cpp

Issue 1976123003: Remove { delete this; } anti-pattern from IXFA_WidgetIterator (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Restore page Release(). Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/fsdk_annothandler.cpp ('k') | xfa/fxfa/app/xfa_ffpageview.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fsdk_mgr.cpp
diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp
index 4ab4850c4d477fe0e8c504cc9cff5a421cfb91c4..2d641783f9bd86b0c454b925c21fa4f60c822b94 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);
« no previous file with comments | « fpdfsdk/fsdk_annothandler.cpp ('k') | xfa/fxfa/app/xfa_ffpageview.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698