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/fxgraphics/cagg_graphics.cpp | 4 +--- xfa/fxgraphics/cfx_path_generator.cpp | 12 +++++------- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'xfa/fxgraphics') diff --git a/xfa/fxgraphics/cagg_graphics.cpp b/xfa/fxgraphics/cagg_graphics.cpp index 4c9e41fea3..a4211810c4 100644 --- a/xfa/fxgraphics/cagg_graphics.cpp +++ b/xfa/fxgraphics/cagg_graphics.cpp @@ -26,7 +26,5 @@ FX_ERR CAGG_Graphics::Create(CFX_Graphics* owner, } CAGG_Graphics::~CAGG_Graphics() { - if (m_owner->m_renderDevice) - delete (CFX_FxgeDevice*)m_owner->m_renderDevice; - m_owner = nullptr; + delete m_owner->m_renderDevice; } diff --git a/xfa/fxgraphics/cfx_path_generator.cpp b/xfa/fxgraphics/cfx_path_generator.cpp index ace3da154f..984e2e9d1a 100644 --- a/xfa/fxgraphics/cfx_path_generator.cpp +++ b/xfa/fxgraphics/cfx_path_generator.cpp @@ -6,18 +6,16 @@ #include "xfa/fxgraphics/cfx_path_generator.h" -CFX_PathGenerator::CFX_PathGenerator() { - m_pPathData = NULL; -} +CFX_PathGenerator::CFX_PathGenerator() : m_pPathData(nullptr) {} + void CFX_PathGenerator::Create() { m_pPathData = new CFX_PathData; } + CFX_PathGenerator::~CFX_PathGenerator() { - if (m_pPathData) { - delete m_pPathData; - m_pPathData = NULL; - } + delete m_pPathData; } + void CFX_PathGenerator::AddPathData(CFX_PathData* pPathData) { if (pPathData && pPathData->GetPointCount() > 0) { int nCount = pPathData->GetPointCount(); -- cgit v1.2.3