From 495bda110a6ea8e7a6fc313ec0232a9ca6e3cfdc Mon Sep 17 00:00:00 2001 From: thestig Date: Thu, 28 Apr 2016 17:29:19 -0700 Subject: Do not check pointers before deleting them. XFA edition. Review-Url: https://codereview.chromium.org/1925363002 --- xfa/fwl/basewidget/fwl_caretimp.cpp | 7 +++---- xfa/fwl/basewidget/fxmath_barcodeimp.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'xfa/fwl/basewidget') diff --git a/xfa/fwl/basewidget/fwl_caretimp.cpp b/xfa/fwl/basewidget/fwl_caretimp.cpp index 3cb2ed60f7..c61c459f2e 100644 --- a/xfa/fwl/basewidget/fwl_caretimp.cpp +++ b/xfa/fwl/basewidget/fwl_caretimp.cpp @@ -44,12 +44,11 @@ CFWL_CaretImp::CFWL_CaretImp(const CFWL_WidgetImpProperties& properties, m_pTimer = new CFWL_CaretTimer(this); SetStates(FWL_STATE_CAT_HightLight); } + CFWL_CaretImp::~CFWL_CaretImp() { - if (m_pTimer) { - delete m_pTimer; - m_pTimer = NULL; - } + delete m_pTimer; } + FWL_ERR CFWL_CaretImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_Caret; return FWL_ERR_Succeeded; diff --git a/xfa/fwl/basewidget/fxmath_barcodeimp.cpp b/xfa/fwl/basewidget/fxmath_barcodeimp.cpp index 5ca0927671..5efd1621c8 100644 --- a/xfa/fwl/basewidget/fxmath_barcodeimp.cpp +++ b/xfa/fwl/basewidget/fxmath_barcodeimp.cpp @@ -46,13 +46,13 @@ static CBC_CodeBase* FX_Barcode_CreateBarCodeEngineObject(BC_TYPE type) { return NULL; } } + CFX_Barcode::CFX_Barcode() {} + CFX_Barcode::~CFX_Barcode() { - if (m_pBCEngine) { - delete m_pBCEngine; - m_pBCEngine = NULL; - } + delete m_pBCEngine; } + FX_BOOL CFX_Barcode::Create(BC_TYPE type) { m_pBCEngine = FX_Barcode_CreateBarCodeEngineObject(type); return m_pBCEngine != NULL; -- cgit v1.2.3