diff options
author | weili <weili@chromium.org> | 2016-08-03 11:06:49 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-03 11:06:49 -0700 |
commit | 2d5b020304e8a9aa8afeb632c61daa7ece87e36d (patch) | |
tree | 4d7f04d4800577fa597b4ca1f1b4d31b87194ef0 /fpdfsdk/formfiller/cffl_iformfiller.cpp | |
parent | ca27127240fbca2184f1c576b15b5212d5b314e6 (diff) | |
download | pdfium-2d5b020304e8a9aa8afeb632c61daa7ece87e36d.tar.xz |
Use smart pointers for class owned pointers
For all classes under /fpdfsdk, use smart pointer to replace
raw pointer type for class owned member variables so that memory
management will be easier.
BUG=pdfium:518
Review-Url: https://codereview.chromium.org/2173253002
Diffstat (limited to 'fpdfsdk/formfiller/cffl_iformfiller.cpp')
-rw-r--r-- | fpdfsdk/formfiller/cffl_iformfiller.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/fpdfsdk/formfiller/cffl_iformfiller.cpp b/fpdfsdk/formfiller/cffl_iformfiller.cpp index 827c44a102..2fd4af1166 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); } |