diff options
author | weili <weili@chromium.org> | 2016-08-04 16:37:48 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-04 16:37:48 -0700 |
commit | 1b4f6b36b3ed8d1f6cea96bc32c1b376f4a499bc (patch) | |
tree | aa3ba6730495096411f2a3555c74e83f5d1fca11 /xfa/fwl/core/fwl_widgetimp.cpp | |
parent | 52a5005c453a9e08384e375ae51c5f1ad628fe86 (diff) | |
download | pdfium-1b4f6b36b3ed8d1f6cea96bc32c1b376f4a499bc.tar.xz |
Use smart pointers for class owned pointers
For classes under xfa/fgas, xfa/fwl/basewidget, and xfa/fwl/core,
use smart pointers instead of raw pointer to make memory management
easier.
BUG=pdfium:518
Review-Url: https://codereview.chromium.org/2207093005
Diffstat (limited to 'xfa/fwl/core/fwl_widgetimp.cpp')
-rw-r--r-- | xfa/fwl/core/fwl_widgetimp.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/xfa/fwl/core/fwl_widgetimp.cpp b/xfa/fwl/core/fwl_widgetimp.cpp index 52a2978908..3aa6233ae5 100644 --- a/xfa/fwl/core/fwl_widgetimp.cpp +++ b/xfa/fwl/core/fwl_widgetimp.cpp @@ -531,7 +531,8 @@ void CFWL_WidgetImp::SetAssociateWidget(void* pAssociate) { CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) - : m_pProperties(new CFWL_WidgetImpProperties), + : m_pWidgetMgr(CFWL_WidgetMgr::GetInstance()), + m_pProperties(new CFWL_WidgetImpProperties(properties)), m_pDelegate(nullptr), m_pCurDelegate(nullptr), m_pOuter(pOuter), @@ -540,14 +541,10 @@ CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties, m_pAssociate(nullptr), m_iLock(0), m_nEventKey(0) { - *m_pProperties = properties; - m_pWidgetMgr = CFWL_WidgetMgr::GetInstance(); ASSERT(m_pWidgetMgr); } -CFWL_WidgetImp::~CFWL_WidgetImp() { - delete m_pProperties; -} +CFWL_WidgetImp::~CFWL_WidgetImp() {} FX_BOOL CFWL_WidgetImp::IsEnabled() const { return (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == 0; |