Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Side by Side Diff: core/src/fxge/apple/fx_quartz_device.cpp

Issue 1192743004: Cleanup: Do not check pointers before deleting them. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxge/apple/apple_int.h ('k') | core/src/fxge/dib/fx_dib_engine.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../../include/fxcrt/fx_ext.h" 7 #include "../../../include/fxcrt/fx_ext.h"
8 #include "../../../include/fxge/fx_freetype.h" 8 #include "../../../include/fxge/fx_freetype.h"
9 #include "../../../include/fxge/fx_ge.h" 9 #include "../../../include/fxge/fx_ge.h"
10 #include "../agg/include/fx_agg_driver.h" 10 #include "../agg/include/fx_agg_driver.h"
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 CFX_QuartzDevice::CFX_QuartzDevice() 1075 CFX_QuartzDevice::CFX_QuartzDevice()
1076 { 1076 {
1077 m_bOwnedBitmap = FALSE; 1077 m_bOwnedBitmap = FALSE;
1078 m_pContext = NULL; 1078 m_pContext = NULL;
1079 } 1079 }
1080 CFX_QuartzDevice::~CFX_QuartzDevice() 1080 CFX_QuartzDevice::~CFX_QuartzDevice()
1081 { 1081 {
1082 if (m_pContext) { 1082 if (m_pContext) {
1083 CGContextRelease(m_pContext); 1083 CGContextRelease(m_pContext);
1084 } 1084 }
1085 if (GetBitmap() && m_bOwnedBitmap) { 1085 if (m_bOwnedBitmap) {
1086 delete GetBitmap(); 1086 delete GetBitmap();
1087 } 1087 }
1088 } 1088 }
1089 CGContextRef CFX_QuartzDevice::GetContext() 1089 CGContextRef CFX_QuartzDevice::GetContext()
1090 { 1090 {
1091 return m_pContext; 1091 return m_pContext;
1092 } 1092 }
1093 FX_BOOL CFX_QuartzDevice::Attach(CGContextRef context, int32_t nDeviceClass) 1093 FX_BOOL CFX_QuartzDevice::Attach(CGContextRef context, int32_t nDeviceClass)
1094 { 1094 {
1095 if (m_pContext) { 1095 if (m_pContext) {
(...skipping 23 matching lines...) Expand all
1119 } 1119 }
1120 CFX_DIBitmap* pBitmap = new CFX_DIBitmap; 1120 CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
1121 if (!pBitmap->Create(width, height, format)) { 1121 if (!pBitmap->Create(width, height, format)) {
1122 delete pBitmap; 1122 delete pBitmap;
1123 return FALSE; 1123 return FALSE;
1124 } 1124 }
1125 m_bOwnedBitmap = TRUE; 1125 m_bOwnedBitmap = TRUE;
1126 return Attach(pBitmap); 1126 return Attach(pBitmap);
1127 } 1127 }
1128 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 1128 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
OLDNEW
« no previous file with comments | « core/src/fxge/apple/apple_int.h ('k') | core/src/fxge/dib/fx_dib_engine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698