From 796c908e7b7bdde819a1e5a4bfd3576d8e8859d6 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 16 Jul 2015 18:45:22 -0700 Subject: Merge to XFA: Cleanup: Do not check pointers before deleting them, part 2. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1195363002 . (cherry picked from commit 21bf242a31eff79f754c5e9c3b41c52e33483bb0) Review URL: https://codereview.chromium.org/1235753006 . --- core/src/fxge/agg/src/fx_agg_driver.cpp | 4 +--- core/src/fxge/android/fpf_skiamodule.cpp | 6 ++---- core/src/fxge/apple/fx_mac_imp.cpp | 4 +--- core/src/fxge/win32/fx_win32_device.cpp | 4 +--- core/src/fxge/win32/fx_win32_dwrite.cpp | 4 +--- 5 files changed, 6 insertions(+), 16 deletions(-) (limited to 'core/src/fxge') diff --git a/core/src/fxge/agg/src/fx_agg_driver.cpp b/core/src/fxge/agg/src/fx_agg_driver.cpp index cb01893d5b..045d586924 100644 --- a/core/src/fxge/agg/src/fx_agg_driver.cpp +++ b/core/src/fxge/agg/src/fx_agg_driver.cpp @@ -207,9 +207,7 @@ CFX_AggDeviceDriver::~CFX_AggDeviceDriver() { delete m_pClipRgn; for (int i = 0; i < m_StateStack.GetSize(); i ++) - if (m_StateStack[i]) { - delete (CFX_ClipRgn*)m_StateStack[i]; - } + delete (CFX_ClipRgn*)m_StateStack[i]; DestroyPlatform(); } #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ diff --git a/core/src/fxge/android/fpf_skiamodule.cpp b/core/src/fxge/android/fpf_skiamodule.cpp index 1d365472e3..be84fcfd0e 100644 --- a/core/src/fxge/android/fpf_skiamodule.cpp +++ b/core/src/fxge/android/fpf_skiamodule.cpp @@ -22,10 +22,8 @@ CFPF_SkiaDeviceModule::~CFPF_SkiaDeviceModule() } void CFPF_SkiaDeviceModule::Destroy() { - if (gs_pPFModule) { - delete (CFPF_SkiaDeviceModule*)gs_pPFModule; - gs_pPFModule = NULL; - } + delete (CFPF_SkiaDeviceModule*)gs_pPFModule; + gs_pPFModule = NULL; } IFPF_FontMgr* CFPF_SkiaDeviceModule::GetFontMgr() { diff --git a/core/src/fxge/apple/fx_mac_imp.cpp b/core/src/fxge/apple/fx_mac_imp.cpp index 38ef02c90f..952af93b60 100644 --- a/core/src/fxge/apple/fx_mac_imp.cpp +++ b/core/src/fxge/apple/fx_mac_imp.cpp @@ -103,9 +103,7 @@ void CFX_GEModule::InitPlatform() } void CFX_GEModule::DestroyPlatform() { - if (m_pPlatformData) { - delete (CApplePlatform *) m_pPlatformData; - } + delete (CApplePlatform *)m_pPlatformData; m_pPlatformData = NULL; } #endif diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp index b7dced9148..2802a7c533 100644 --- a/core/src/fxge/win32/fx_win32_device.cpp +++ b/core/src/fxge/win32/fx_win32_device.cpp @@ -413,9 +413,7 @@ void CFX_GEModule::InitPlatform() } void CFX_GEModule::DestroyPlatform() { - if (m_pPlatformData) { - delete (CWin32Platform*)m_pPlatformData; - } + delete (CWin32Platform*)m_pPlatformData; m_pPlatformData = NULL; } CGdiDeviceDriver::CGdiDeviceDriver(HDC hDC, int device_class) diff --git a/core/src/fxge/win32/fx_win32_dwrite.cpp b/core/src/fxge/win32/fx_win32_dwrite.cpp index 28846667e5..7949888ac2 100644 --- a/core/src/fxge/win32/fx_win32_dwrite.cpp +++ b/core/src/fxge/win32/fx_win32_dwrite.cpp @@ -266,9 +266,7 @@ FX_BOOL CDWriteExt::DwRendingString(void* renderTarget, CFX_ClipRgn* pClipRgn, F } void CDWriteExt::DwDeleteRenderingTarget(void* renderTarget) { - if (renderTarget) { - delete (CDwGdiTextRenderer*)renderTarget; - } + delete (CDwGdiTextRenderer*)renderTarget; } void CDWriteExt::DwDeleteFont(void* pFont) { -- cgit v1.2.3