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

Side by Side Diff: fpdfsdk/src/fpdfformfill.cpp

Issue 1195363002: Cleanup: Do not check pointers before deleting them, part 2. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 5 years, 5 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
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 "../../public/fpdf_formfill.h" 7 #include "../../public/fpdf_formfill.h"
8 #include "../../public/fpdfview.h" 8 #include "../../public/fpdfview.h"
9 #include "../../third_party/base/nonstd_unique_ptr.h" 9 #include "../../third_party/base/nonstd_unique_ptr.h"
10 #include "../include/fsdk_define.h" 10 #include "../include/fsdk_define.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 pContext = NULL; 222 pContext = NULL;
223 pDevice = NULL; 223 pDevice = NULL;
224 return; 224 return;
225 } 225 }
226 if(CPDFSDK_PageView* pPageView = pFXDoc->GetPageView(pPage)) 226 if(CPDFSDK_PageView* pPageView = pFXDoc->GetPageView(pPage))
227 { 227 {
228 pPageView->PageView_OnDraw(pDevice, &matrix, &options); 228 pPageView->PageView_OnDraw(pDevice, &matrix, &options);
229 } 229 }
230 pDevice->RestoreState(); 230 pDevice->RestoreState();
231 231
232 » if(options.m_pOCContext) 232 delete options.m_pOCContext;
Tom Sepez 2015/07/16 17:22:44 nit: funny indent.
Lei Zhang 2015/07/16 21:20:48 merge resolved this.
233 » { 233 options.m_pOCContext = NULL;
234 » » delete options.m_pOCContext;
235 » » options.m_pOCContext = NULL;
236 » }
237 » if(pContext)
238 » {
239 » » delete pContext;
240 » » pContext = NULL;
241 » }
242 » if(pDevice)
243 » {
244 » » delete pDevice;
245 » » pDevice = NULL;
246 » }
247 234
235 delete pContext;
236 pContext = NULL;
Tom Sepez 2015/07/16 17:22:44 nit: pointless assignments?
237 delete pDevice;
238 pDevice = NULL;
248 } 239 }
249 240
250 DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, int fieldType, unsigned long color) 241 DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, int fieldType, unsigned long color)
251 { 242 {
252 if (!hHandle) 243 if (!hHandle)
253 return; 244 return;
254 // CPDFDoc_Environment* pEnv = (CPDFDoc_Environment* )hHandle; 245 // CPDFDoc_Environment* pEnv = (CPDFDoc_Environment* )hHandle;
255 CPDFSDK_Document* pSDKDoc = ((CPDFDoc_Environment*)hHandle)->GetCurrentD oc(); 246 CPDFSDK_Document* pSDKDoc = ((CPDFDoc_Environment*)hHandle)->GetCurrentD oc();
256 if(pSDKDoc) 247 if(pSDKDoc)
257 { 248 {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 if (bExistCAAction) 388 if (bExistCAAction)
398 { 389 {
399 CPDF_Action action = aa.GetAction(CPDF_AAction:: ClosePage); 390 CPDF_Action action = aa.GetAction(CPDF_AAction:: ClosePage);
400 pActionHandler->DoAction_Page(action, CPDF_AActi on::ClosePage, pSDKDoc); 391 pActionHandler->DoAction_Page(action, CPDF_AActi on::ClosePage, pSDKDoc);
401 } 392 }
402 } 393 }
403 } 394 }
404 } 395 }
405 396
406 397
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698