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/theme/cfwl_widgettp.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'xfa/fwl/theme/cfwl_widgettp.cpp') diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index 7f4e547e24..1ff241636f 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp @@ -741,27 +741,26 @@ uint32_t FWL_GetThemeColor(uint32_t dwThemeID) { } CFWL_ArrowData* CFWL_ArrowData::m_pInstance = NULL; + CFWL_ArrowData* CFWL_ArrowData::GetInstance() { - if (!m_pInstance) { + if (!m_pInstance) m_pInstance = new CFWL_ArrowData; - } return m_pInstance; } + FX_BOOL CFWL_ArrowData::IsInstance() { - return (m_pInstance != NULL); + return !!m_pInstance; } + void CFWL_ArrowData::DestroyInstance() { - if (m_pInstance) { - delete m_pInstance; - m_pInstance = NULL; - } + delete m_pInstance; + m_pInstance = nullptr; } + CFWL_ArrowData::~CFWL_ArrowData() { - if (m_pColorData) { - delete m_pColorData; - m_pColorData = NULL; - } + delete m_pColorData; } + void CFWL_ArrowData::SetColorData(uint32_t dwID) { if (!m_pColorData) { m_pColorData = new CColorData; -- cgit v1.2.3