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_textfield.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_textfield.cpp')
-rw-r--r-- | fpdfsdk/formfiller/cffl_textfield.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp index d24452fd45..76f4b7414d 100644 --- a/fpdfsdk/formfiller/cffl_textfield.cpp +++ b/fpdfsdk/formfiller/cffl_textfield.cpp @@ -11,14 +11,11 @@ #include "fpdfsdk/include/fsdk_mgr.h" CFFL_TextField::CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot) - : CFFL_FormFiller(pApp, pAnnot), m_pFontMap(nullptr) { - m_State.nStart = m_State.nEnd = 0; -} + : CFFL_FormFiller(pApp, pAnnot) {} CFFL_TextField::~CFFL_TextField() { for (const auto& it : m_Maps) it.second->InvalidateFocusHandler(this); - delete m_pFontMap; } PWL_CREATEPARAM CFFL_TextField::GetCreateParam() { @@ -68,8 +65,8 @@ PWL_CREATEPARAM CFFL_TextField::GetCreateParam() { } if (!m_pFontMap) - m_pFontMap = new CBA_FontMap(m_pWidget, m_pApp->GetSysHandler()); - cp.pFontMap = m_pFontMap; + m_pFontMap.reset(new CBA_FontMap(m_pWidget, m_pApp->GetSysHandler())); + cp.pFontMap = m_pFontMap.get(); cp.pFocusHandler = this; return cp; |