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

Unified Diff: fpdfsdk/formfiller/cffl_iformfiller.cpp

Issue 2173253002: Use smart pointers for class owned pointers (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments Created 4 years, 4 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/formfiller/cffl_iformfiller.h ('k') | fpdfsdk/formfiller/cffl_listbox.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/formfiller/cffl_iformfiller.cpp
diff --git a/fpdfsdk/formfiller/cffl_iformfiller.cpp b/fpdfsdk/formfiller/cffl_iformfiller.cpp
index 827c44a10298d304dc09c7ef706bb43d769f432e..2fd4af1166082b9c621d6dc6b545b35334900456 100644
--- a/fpdfsdk/formfiller/cffl_iformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_iformfiller.cpp
@@ -24,11 +24,7 @@
CFFL_IFormFiller::CFFL_IFormFiller(CPDFDoc_Environment* pApp)
: m_pApp(pApp), m_bNotifying(FALSE) {}
-CFFL_IFormFiller::~CFFL_IFormFiller() {
- for (auto& it : m_Maps)
- delete it.second;
- m_Maps.clear();
-}
+CFFL_IFormFiller::~CFFL_IFormFiller() {}
FX_BOOL CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
@@ -511,7 +507,7 @@ CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot,
FX_BOOL bRegister) {
auto it = m_Maps.find(pAnnot);
if (it != m_Maps.end())
- return it->second;
+ return it->second.get();
if (!bRegister)
return nullptr;
@@ -547,7 +543,7 @@ CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot,
if (!pFormFiller)
return nullptr;
- m_Maps[pAnnot] = pFormFiller;
+ m_Maps[pAnnot].reset(pFormFiller);
return pFormFiller;
}
@@ -562,7 +558,6 @@ void CFFL_IFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot) {
if (it == m_Maps.end())
return;
- delete it->second;
m_Maps.erase(it);
}
« no previous file with comments | « fpdfsdk/formfiller/cffl_iformfiller.h ('k') | fpdfsdk/formfiller/cffl_listbox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698