diff options
author | thestig <thestig@chromium.org> | 2016-04-28 17:29:19 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-28 17:29:19 -0700 |
commit | 495bda110a6ea8e7a6fc313ec0232a9ca6e3cfdc (patch) | |
tree | 42abda300274f81009bdb9866e0f7e3f81164726 /xfa/fwl/theme/cfwl_formtp.cpp | |
parent | a31098417852bdf13e693a6e0913e0706cf94098 (diff) | |
download | pdfium-495bda110a6ea8e7a6fc313ec0232a9ca6e3cfdc.tar.xz |
Do not check pointers before deleting them.
XFA edition.
Review-Url: https://codereview.chromium.org/1925363002
Diffstat (limited to 'xfa/fwl/theme/cfwl_formtp.cpp')
-rw-r--r-- | xfa/fwl/theme/cfwl_formtp.cpp | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/xfa/fwl/theme/cfwl_formtp.cpp b/xfa/fwl/theme/cfwl_formtp.cpp index ec06f4ad24..4a18ea0cc4 100644 --- a/xfa/fwl/theme/cfwl_formtp.cpp +++ b/xfa/fwl/theme/cfwl_formtp.cpp @@ -35,30 +35,27 @@ CFWL_FormTP::CFWL_FormTP() : m_pActiveBitmap(NULL), m_pDeactivebitmap(NULL) { m_rtDisBBorder.Reset(); m_rtDisCaption.Reset(); } + CFWL_FormTP::~CFWL_FormTP() { - if (m_pThemeData) { - delete m_pThemeData; - m_pThemeData = NULL; - } + delete m_pThemeData; } + FWL_ERR CFWL_FormTP::Initialize() { InitTTO(); InitCaption(TRUE); InitCaption(FALSE); return CFWL_WidgetTP::Initialize(); } + FWL_ERR CFWL_FormTP::Finalize() { FinalizeTTO(); - if (m_pActiveBitmap) { - delete m_pActiveBitmap; - m_pActiveBitmap = NULL; - } - if (m_pDeactivebitmap) { - delete m_pDeactivebitmap; - m_pDeactivebitmap = NULL; - } + delete m_pActiveBitmap; + m_pActiveBitmap = nullptr; + delete m_pDeactivebitmap; + m_pDeactivebitmap = nullptr; return CFWL_WidgetTP::Finalize(); } + FX_BOOL CFWL_FormTP::IsValidWidget(IFWL_Widget* pWidget) { if (!pWidget) return FALSE; @@ -850,10 +847,7 @@ void CFWL_FormTP::InitCaption(FX_BOOL bActive) { CFX_Graphics gs; CFX_Path path; path.Create(); - if (m_pActiveBitmap) { - delete m_pActiveBitmap; - m_pActiveBitmap = NULL; - } + delete m_pActiveBitmap; m_pActiveBitmap = new CFX_DIBitmap; m_pActiveBitmap->Create(1, FWLTHEME_CAPACITY_CYCaption, FXDIB_Argb); dev.Attach(m_pActiveBitmap); @@ -875,10 +869,7 @@ void CFWL_FormTP::InitCaption(FX_BOOL bActive) { CFX_Graphics gs; CFX_Path path; path.Create(); - if (m_pDeactivebitmap) { - delete m_pDeactivebitmap; - m_pDeactivebitmap = NULL; - } + delete m_pDeactivebitmap; m_pDeactivebitmap = new CFX_DIBitmap; m_pDeactivebitmap->Create(1, FWLTHEME_CAPACITY_CYCaption, FXDIB_Argb); dev.Attach(m_pDeactivebitmap); |