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

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: 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..54701c22ee463ad4d8606cd426cb3152681b5dc2 100644
--- a/fpdfsdk/fsdk_mgr.cpp
+++ b/fpdfsdk/fsdk_mgr.cpp
@@ -905,12 +905,12 @@ 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();
Lei Zhang 2016/05/14 00:43:53 Isn't this still needed to balance out line 905?
Tom Sepez 2016/05/16 16:15:58 Acknowledged. Done.
SetLock(FALSE);
return;
}
@@ -919,11 +919,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