From 2d5b020304e8a9aa8afeb632c61daa7ece87e36d Mon Sep 17 00:00:00 2001 From: weili Date: Wed, 3 Aug 2016 11:06:49 -0700 Subject: 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 --- fpdfsdk/formfiller/cffl_textfield.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'fpdfsdk/formfiller/cffl_textfield.cpp') 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; -- cgit v1.2.3